From: Tay Ray Chuan <rctay89@gmail.com>
To: git@vger.kernel.org
Cc: Miklos Vajna <vmiklos@frugalware.org>,
Nicolas Pitre <nico@fluxnic.net>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH 1/4] check stderr with isatty() instead of stdout when deciding to show progress
Date: Sat, 26 Dec 2009 01:12:03 +0800 [thread overview]
Message-ID: <1261761126-5784-2-git-send-email-rctay89@gmail.com> (raw)
In-Reply-To: <1261761126-5784-1-git-send-email-rctay89@gmail.com>
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>
---
Documentation/git-clone.txt | 2 +-
transport-helper.c | 2 +-
transport.c | 2 +-
transport.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 7ccd742..f298fdd 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 11f3d7e..b886985 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -169,7 +169,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 3eea836..24c7f1d 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 9e74406..68fda6a 100644
--- a/transport.h
+++ b/transport.h
@@ -63,7 +63,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;
};
--
1.6.6.278.g3f5f
next prev parent reply other threads:[~2009-12-25 17:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 4:54 [PATCH/RFC] Add progress options Brent Goodrick
2009-12-25 17:12 ` [PATCH 0/4] clone: use --progress to mean -v Tay Ray Chuan
2009-12-25 17:12 ` Tay Ray Chuan [this message]
2009-12-25 17:12 ` [PATCH 2/4] git-clone.txt: reword description of progress behaviour Tay Ray Chuan
2009-12-25 17:12 ` [PATCH 3/4] clone: set transport->verbose when -v/--verbose is used Tay Ray Chuan
2009-12-25 17:12 ` [PATCH 4/4] clone: use --progress to force progress reporting Tay Ray Chuan
2009-12-27 1:20 ` Miklos Vajna
2009-12-27 3:22 ` Tay Ray Chuan
2009-12-26 8:53 ` [PATCH 0/4] clone: use --progress to mean -v Johannes Schindelin
2009-12-27 3:27 ` Tay Ray Chuan
2009-12-29 1:30 ` Junio C Hamano
2009-12-29 3:06 ` Tay Ray Chuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1261761126-5784-2-git-send-email-rctay89@gmail.com \
--to=rctay89@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@fluxnic.net \
--cc=vmiklos@frugalware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).