summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Tay Ray Chuan <rctay89@gmail.com>2009-12-26 01:12:03 +0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-12-28 18:49:18 -0800
commit486a3d716427ac81594fe63d4e9cae64703dbc56 (patch)
tree1c13bedf6777331e9d88ae402605f47e117fa02d
parentGit 1.6.6 (diff)
downloadtgif-486a3d716427ac81594fe63d4e9cae64703dbc56.tar.xz
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>
-rw-r--r--Documentation/git-clone.txt2
-rw-r--r--transport-helper.c2
-rw-r--r--transport.c2
-rw-r--r--transport.h2
4 files changed, 4 insertions, 4 deletions
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 7ccd742a87..f298fdd4c2 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -101,7 +101,7 @@ objects from the source repository into a pack in the cloned repository.
--verbose::
-v::
- Display the progress bar, even in case the standard output is not
+ Display the progress bar, even in case the standard error is not
a terminal.
--no-checkout::
diff --git a/transport-helper.c b/transport-helper.c
index 5078c7100f..bfe3bc30a9 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -144,7 +144,7 @@ static void standard_options(struct transport *t)
char buf[16];
int n;
int v = t->verbose;
- int no_progress = v < 0 || (!t->progress && !isatty(1));
+ int no_progress = v < 0 || (!t->progress && !isatty(2));
set_helper_option(t, "progress", !no_progress ? "true" : "false");
diff --git a/transport.c b/transport.c
index 7362ec09b2..31c88f33a5 100644
--- a/transport.c
+++ b/transport.c
@@ -476,7 +476,7 @@ static int fetch_refs_via_pack(struct transport *transport,
args.include_tag = data->followtags;
args.verbose = (transport->verbose > 0);
args.quiet = (transport->verbose < 0);
- args.no_progress = args.quiet || (!transport->progress && !isatty(1));
+ args.no_progress = args.quiet || (!transport->progress && !isatty(2));
args.depth = data->depth;
for (i = 0; i < nr_heads; i++)
diff --git a/transport.h b/transport.h
index e4e6177e26..98bb623c45 100644
--- a/transport.h
+++ b/transport.h
@@ -26,7 +26,7 @@ struct transport {
int (*disconnect)(struct transport *connection);
char *pack_lockfile;
signed verbose : 3;
- /* Force progress even if the output is not a tty */
+ /* Force progress even if stderr is not a tty */
unsigned progress : 1;
};