common progress display support

Instead of having this code duplicated in multiple places, let's have
a common interface for progress display.  If someday someone wishes to
display a cheezy progress bar instead then only one file will have to
be changed.

Note: I left merge-recursive.c out since it has a strange notion of
progress as it apparently increase the expected total number as it goes.
Someone with more intimate knowledge of what that is supposed to mean
might look at converting it to the common progress interface.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Nicolas Pitre
2007-04-18 14:27:45 -04:00
committed by Junio C Hamano
parent f1af60bdba
commit 96a02f8f6d
7 changed files with 154 additions and 185 deletions

14
progress.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef __progress_h__
#define __progress_h__
struct progress {
const char *msg;
unsigned total;
unsigned last_percent;
};
int display_progress(struct progress *progress, unsigned n);
void start_progress(struct progress *progress, const char *msg, unsigned total);
void stop_progress(struct progress *progress);
#endif