Skip to content

Commit dd2a0d9

Browse files
committed
Merge branch 'js/progress-delay-fix'
The start_delayed_progress() function in the progress eye-candy API did not clear its internal state, making an initial delay value larger than 1 second ineffective, which has been corrected. * js/progress-delay-fix: progress: pay attention to (customized) delay time
2 parents e345b77 + 457534d commit dd2a0d9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Documentation/git.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ other
684684

685685
`GIT_PROGRESS_DELAY`::
686686
A number controlling how many seconds to delay before showing
687-
optional progress indicators. Defaults to 2.
687+
optional progress indicators. Defaults to 1.
688688

689689
`GIT_EDITOR`::
690690
This environment variable overrides `$EDITOR` and `$VISUAL`.

progress.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,19 @@ static void display(struct progress *progress, uint64_t n, const char *done)
114114
const char *tp;
115115
struct strbuf *counters_sb = &progress->counters_sb;
116116
int show_update = 0;
117+
int update = !!progress_update;
117118
int last_count_len = counters_sb->len;
118119

119-
if (progress->delay && (!progress_update || --progress->delay))
120+
progress_update = 0;
121+
122+
if (progress->delay && (!update || --progress->delay))
120123
return;
121124

122125
progress->last_value = n;
123126
tp = (progress->throughput) ? progress->throughput->display.buf : "";
124127
if (progress->total) {
125128
unsigned percent = n * 100 / progress->total;
126-
if (percent != progress->last_percent || progress_update) {
129+
if (percent != progress->last_percent || update) {
127130
progress->last_percent = percent;
128131

129132
strbuf_reset(counters_sb);
@@ -133,7 +136,7 @@ static void display(struct progress *progress, uint64_t n, const char *done)
133136
tp);
134137
show_update = 1;
135138
}
136-
} else if (progress_update) {
139+
} else if (update) {
137140
strbuf_reset(counters_sb);
138141
strbuf_addf(counters_sb, "%"PRIuMAX"%s", (uintmax_t)n, tp);
139142
show_update = 1;
@@ -166,7 +169,6 @@ static void display(struct progress *progress, uint64_t n, const char *done)
166169
}
167170
fflush(stderr);
168171
}
169-
progress_update = 0;
170172
}
171173
}
172174

@@ -281,7 +283,7 @@ static int get_default_delay(void)
281283
static int delay_in_secs = -1;
282284

283285
if (delay_in_secs < 0)
284-
delay_in_secs = git_env_ulong("GIT_PROGRESS_DELAY", 2);
286+
delay_in_secs = git_env_ulong("GIT_PROGRESS_DELAY", 1);
285287

286288
return delay_in_secs;
287289
}

0 commit comments

Comments
 (0)