OSDN Git Service

Merge branch 'en/rename-progress'
[git-core/git.git] / progress.c
index edb97b1..5a99c9f 100644 (file)
@@ -34,7 +34,6 @@ struct progress {
        uint64_t total;
        unsigned last_percent;
        unsigned delay;
-       unsigned delayed_percent_threshold;
        struct throughput *throughput;
        uint64_t start_ns;
 };
@@ -83,20 +82,8 @@ static int display(struct progress *progress, uint64_t n, const char *done)
 {
        const char *eol, *tp;
 
-       if (progress->delay) {
-               if (!progress_update || --progress->delay)
-                       return 0;
-               if (progress->total) {
-                       unsigned percent = n * 100 / progress->total;
-                       if (percent > progress->delayed_percent_threshold) {
-                               /* inhibit this progress report entirely */
-                               clear_progress_signal();
-                               progress->delay = -1;
-                               progress->total = 0;
-                               return 0;
-                       }
-               }
-       }
+       if (progress->delay && (!progress_update || --progress->delay))
+               return 0;
 
        progress->last_value = n;
        tp = (progress->throughput) ? progress->throughput->display.buf : "";
@@ -207,7 +194,7 @@ int display_progress(struct progress *progress, uint64_t n)
 }
 
 static struct progress *start_progress_delay(const char *title, uint64_t total,
-                                            unsigned percent_threshold, unsigned delay)
+                                            unsigned delay)
 {
        struct progress *progress = malloc(sizeof(*progress));
        if (!progress) {
@@ -220,7 +207,6 @@ static struct progress *start_progress_delay(const char *title, uint64_t total,
        progress->total = total;
        progress->last_value = -1;
        progress->last_percent = -1;
-       progress->delayed_percent_threshold = percent_threshold;
        progress->delay = delay;
        progress->throughput = NULL;
        progress->start_ns = getnanotime();
@@ -230,12 +216,12 @@ static struct progress *start_progress_delay(const char *title, uint64_t total,
 
 struct progress *start_delayed_progress(const char *title, uint64_t total)
 {
-       return start_progress_delay(title, total, 0, 2);
+       return start_progress_delay(title, total, 2);
 }
 
 struct progress *start_progress(const char *title, uint64_t total)
 {
-       return start_progress_delay(title, total, 0, 0);
+       return start_progress_delay(title, total, 0);
 }
 
 void stop_progress(struct progress **p_progress)