summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-17 15:58:58 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-17 15:58:58 -0800
commit42aac96763a72b5bac73d34640d3a0c6233027a6 (patch)
tree8979b93510d3d1fe1334c72fc47c4f91c90b07f3
parentd0605072911a4c93a7eacf1fb55e79227c457e34 (diff)
parent5a518ad4679c91f0d0afd38fcc3cbf04e8699c46 (diff)
downloadgit-42aac96763a72b5bac73d34640d3a0c6233027a6.tar.gz
Merge branch 'tc/clone-v-progress'
* tc/clone-v-progress: clone: use --progress to force progress reporting clone: set transport->verbose when -v/--verbose is used git-clone.txt: reword description of progress behaviour check stderr with isatty() instead of stdout when deciding to show progress Conflicts: transport.c
-rw-r--r--Documentation/git-clone.txt12
-rw-r--r--builtin-clone.c6
-rwxr-xr-xt/t5702-clone-options.sh3
-rw-r--r--transport-helper.c2
-rw-r--r--transport.c2
-rw-r--r--transport.h2
6 files changed, 20 insertions, 7 deletions
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 7ccd742a87..f43c8b2c08 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -96,13 +96,19 @@ objects from the source repository into a pack in the cloned repository.
--quiet::
-q::
- Operate quietly. This flag is also passed to the `rsync'
+ Operate quietly. Progress is not reported to the standard
+ error stream. This flag is also passed to the `rsync'
command when given.
--verbose::
-v::
- Display the progress bar, even in case the standard output is not
- a terminal.
+ Run verbosely.
+
+--progress::
+ Progress status is reported on the standard error stream
+ by default when it is attached to a terminal, unless -q
+ is specified. This flag forces progress status even if the
+ standard error stream is not directed to a terminal.
--no-checkout::
-n::
diff --git a/builtin-clone.c b/builtin-clone.c
index 5df8b0f72c..58bacbd552 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -44,10 +44,13 @@ static char *option_origin = NULL;
static char *option_branch = NULL;
static char *option_upload_pack = "git-upload-pack";
static int option_verbose;
+static int option_progress;
static struct option builtin_clone_options[] = {
OPT__QUIET(&option_quiet),
OPT__VERBOSE(&option_verbose),
+ OPT_BOOLEAN(0, "progress", &option_progress,
+ "force progress reporting"),
OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
"don't create a checkout"),
OPT_BOOLEAN(0, "bare", &option_bare, "create a bare repository"),
@@ -526,6 +529,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_quiet)
transport->verbose = -1;
else if (option_verbose)
+ transport->verbose = 1;
+
+ if (option_progress)
transport->progress = 1;
if (option_upload_pack)
diff --git a/t/t5702-clone-options.sh b/t/t5702-clone-options.sh
index 27825f5f31..02cb024723 100755
--- a/t/t5702-clone-options.sh
+++ b/t/t5702-clone-options.sh
@@ -27,7 +27,8 @@ test_expect_success 'redirected clone' '
'
test_expect_success 'redirected clone -v' '
- git clone -v "file://$(pwd)/parent" clone-redirected-v >out 2>err &&
+ git clone --progress "file://$(pwd)/parent" clone-redirected-progress \
+ >out 2>err &&
test -s err
'
diff --git a/transport-helper.c b/transport-helper.c
index 6ece0d9875..ca8fa92e63 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -273,7 +273,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 3b489b392b..c3f156ea04 100644
--- a/transport.c
+++ b/transport.c
@@ -478,7 +478,7 @@ static int fetch_refs_via_pack(struct transport *transport,
args.include_tag = data->options.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->options.depth;
for (i = 0; i < nr_heads; i++)
diff --git a/transport.h b/transport.h
index 97ba2519dd..7a242fe3bd 100644
--- a/transport.h
+++ b/transport.h
@@ -74,7 +74,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;
/*
* If transport is at least potentially smart, this points to