summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2439755)
raw | patch | inline | side by side (parent: 2439755)
author | Johannes Sixt <johannes.sixt@telecom.at> | |
Mon, 19 Nov 2007 19:48:58 +0000 (20:48 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 20 Nov 2007 21:16:15 +0000 (13:16 -0800) |
This will make progress display from pack-objects (invoked via
upload-pack) more responsive on platforms with an implementation
of stdio whose stderr is line buffered.
The standard error stream is defined to be merely "not fully
buffered"; this is different from "unbuffered". If the
implementation of the stdio library chooses to make it line
buffered, progress reports that end with CR but do not contain
LF will accumulate in the stdio buffer before written out. A
fflush() after each progress display gives a nice continuous
progress.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
upload-pack) more responsive on platforms with an implementation
of stdio whose stderr is line buffered.
The standard error stream is defined to be merely "not fully
buffered"; this is different from "unbuffered". If the
implementation of the stdio library chooses to make it line
buffered, progress reports that end with CR but do not contain
LF will accumulate in the stdio buffer before written out. A
fflush() after each progress display gives a nice continuous
progress.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
progress.c | patch | blob | history |
diff --git a/progress.c b/progress.c
index 4bd650f9ba496786029791bc8a0a40b611bdeb63..d19f80c0bb25928383f8a1aff3f6f49f9a65131c 100644 (file)
--- a/progress.c
+++ b/progress.c
fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
progress->title, percent, n,
progress->total, tp, eol);
+ fflush(stderr);
progress_update = 0;
return 1;
}
} else if (progress_update) {
fprintf(stderr, "%s: %u%s%s", progress->title, n, tp, eol);
+ fflush(stderr);
progress_update = 0;
return 1;
}
if (!progress) {
/* unlikely, but here's a good fallback */
fprintf(stderr, "%s...\n", title);
+ fflush(stderr);
return NULL;
}
progress->title = title;