check stderr with isatty() instead of stdout when deciding to show progress
Make transport code (viz. transport.c::fetch_refs_via_pack() and transport-helper.c::standard_options()) that decides to show progress check if stderr is a terminal, instead of stdout. After all, progress reports (via the API in progress.[ch]) are sent to stderr. Update the documentation for git-clone to say "standard error" as well. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Dec 26, 2009 at 01:12 UTC
486a3d716427ac81594fe63d4e9cae64703dbc56
4 files changed
+4
-4
Documentation/git-clone.txt
+1
-1
@@ -101,7 +101,7 @@ objects from the source repository into a pack in the cloned repository.
101
102
--verbose::
103
-v::
104
- Display the progress bar, even in case the standard output is not
104
+ Display the progress bar, even in case the standard error is not
105
a terminal.
106
107
--no-checkout::
transport-helper.c
+1
-1
@@ -144,7 +144,7 @@ static void standard_options(struct transport *t)
144
char buf[16];
145
int n;
146
int v = t->verbose;
147
- int no_progress = v < 0 || (!t->progress && !isatty(1));
147
+ int no_progress = v < 0 || (!t->progress && !isatty(2));
148
149
set_helper_option(t, "progress", !no_progress ? "true" : "false");
150
transport.c
+1
-1
@@ -476,7 +476,7 @@ static int fetch_refs_via_pack(struct transport *transport,
476
args.include_tag = data->followtags;
477
args.verbose = (transport->verbose > 0);
478
args.quiet = (transport->verbose < 0);
479
- args.no_progress = args.quiet || (!transport->progress && !isatty(1));
479
+ args.no_progress = args.quiet || (!transport->progress && !isatty(2));
480
args.depth = data->depth;
481
482
for (i = 0; i < nr_heads; i++)
transport.h
+1
-1
@@ -26,7 +26,7 @@ struct transport {
26
int (*disconnect)(struct transport *connection);
27
char *pack_lockfile;
28
signed verbose : 3;
29
- /* Force progress even if the output is not a tty */
29
+ /* Force progress even if stderr is not a tty */
30
unsigned progress : 1;
31
};
32