progress: drop delay-threshold code
Since 180a9f2268 (provide a facility for "delayed" progress reporting, 2007-04-20), the progress code has allowed callers to skip showing progress if they have reached a percentage-threshold of the total work before the delay period passes. But since 8aade107dd (progress: simplify "delayed" progress API, 2017-08-19), that parameter is not available to outside callers (we always passed zero after that commit, though that was corrected in the previous commit to "100%"). Let's drop the threshold code, which never triggers in any meaningful way. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lars Schneider committed
Dec 4, 2017 at 17:07 UTC
9c5951cacf5cf2a4828480176921ca0307d22746
1 file changed
+5
-19
progress.c
+5
-19
@@ -34,7 +34,6 @@ struct progress {
34
unsigned total;
35
unsigned last_percent;
36
unsigned delay;
37
- unsigned delayed_percent_threshold;
37
struct throughput *throughput;
38
uint64_t start_ns;
39
};
@@ -83,20 +82,8 @@ static int display(struct progress *progress, unsigned n, const char *done)
82
{
83
const char *eol, *tp;
84
86
- if (progress->delay) {
87
- if (!progress_update || --progress->delay)
88
- return 0;
89
- if (progress->total) {
90
- unsigned percent = n * 100 / progress->total;
91
- if (percent > progress->delayed_percent_threshold) {
92
- /* inhibit this progress report entirely */
93
- clear_progress_signal();
94
- progress->delay = -1;
95
- progress->total = 0;
96
- return 0;
97
- }
98
- }
99
- }
85
+ if (progress->delay && (!progress_update || --progress->delay))
86
+ return 0;
87
88
progress->last_value = n;
89
tp = (progress->throughput) ? progress->throughput->display.buf : "";
@@ -206,7 +193,7 @@ int display_progress(struct progress *progress, unsigned n)
193
}
194
195
static struct progress *start_progress_delay(const char *title, unsigned total,
209
- unsigned percent_threshold, unsigned delay)
196
+ unsigned delay)
197
{
198
struct progress *progress = malloc(sizeof(*progress));
199
if (!progress) {
@@ -219,7 +206,6 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
206
progress->total = total;
207
progress->last_value = -1;
208
progress->last_percent = -1;
222
- progress->delayed_percent_threshold = percent_threshold;
209
progress->delay = delay;
210
progress->throughput = NULL;
211
progress->start_ns = getnanotime();
@@ -229,12 +215,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
215
216
struct progress *start_delayed_progress(const char *title, unsigned total)
217
{
232
- return start_progress_delay(title, total, 100, 2);
218
+ return start_progress_delay(title, total, 2);
219
}
220
221
struct progress *start_progress(const char *title, unsigned total)
222
{
237
- return start_progress_delay(title, total, 0, 0);
223
+ return start_progress_delay(title, total, 0);
224
}
225
226
void stop_progress(struct progress **p_progress)