Skip to content

Commit 486a3d7

Browse files
rctaygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 902f235 commit 486a3d7

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Documentation/git-clone.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ objects from the source repository into a pack in the cloned repository.
101101

102102
--verbose::
103103
-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
105105
a terminal.
106106

107107
--no-checkout::

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static void standard_options(struct transport *t)
144144
char buf[16];
145145
int n;
146146
int v = t->verbose;
147-
int no_progress = v < 0 || (!t->progress && !isatty(1));
147+
int no_progress = v < 0 || (!t->progress && !isatty(2));
148148

149149
set_helper_option(t, "progress", !no_progress ? "true" : "false");
150150

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static int fetch_refs_via_pack(struct transport *transport,
476476
args.include_tag = data->followtags;
477477
args.verbose = (transport->verbose > 0);
478478
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));
480480
args.depth = data->depth;
481481

482482
for (i = 0; i < nr_heads; i++)

transport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct transport {
2626
int (*disconnect)(struct transport *connection);
2727
char *pack_lockfile;
2828
signed verbose : 3;
29-
/* Force progress even if the output is not a tty */
29+
/* Force progress even if stderr is not a tty */
3030
unsigned progress : 1;
3131
};
3232

0 commit comments

Comments
 (0)