Skip to content

Commit 42aac96

Browse files
committed
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
2 parents d060507 + 5a518ad commit 42aac96

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

Documentation/git-clone.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,19 @@ objects from the source repository into a pack in the cloned repository.
9696

9797
--quiet::
9898
-q::
99-
Operate quietly. This flag is also passed to the `rsync'
99+
Operate quietly. Progress is not reported to the standard
100+
error stream. This flag is also passed to the `rsync'
100101
command when given.
101102

102103
--verbose::
103104
-v::
104-
Display the progress bar, even in case the standard output is not
105-
a terminal.
105+
Run verbosely.
106+
107+
--progress::
108+
Progress status is reported on the standard error stream
109+
by default when it is attached to a terminal, unless -q
110+
is specified. This flag forces progress status even if the
111+
standard error stream is not directed to a terminal.
106112

107113
--no-checkout::
108114
-n::

builtin-clone.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ static char *option_origin = NULL;
4444
static char *option_branch = NULL;
4545
static char *option_upload_pack = "git-upload-pack";
4646
static int option_verbose;
47+
static int option_progress;
4748

4849
static struct option builtin_clone_options[] = {
4950
OPT__QUIET(&option_quiet),
5051
OPT__VERBOSE(&option_verbose),
52+
OPT_BOOLEAN(0, "progress", &option_progress,
53+
"force progress reporting"),
5154
OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
5255
"don't create a checkout"),
5356
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)
526529
if (option_quiet)
527530
transport->verbose = -1;
528531
else if (option_verbose)
532+
transport->verbose = 1;
533+
534+
if (option_progress)
529535
transport->progress = 1;
530536

531537
if (option_upload_pack)

t/t5702-clone-options.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ test_expect_success 'redirected clone' '
2727
'
2828
test_expect_success 'redirected clone -v' '
2929
30-
git clone -v "file://$(pwd)/parent" clone-redirected-v >out 2>err &&
30+
git clone --progress "file://$(pwd)/parent" clone-redirected-progress \
31+
>out 2>err &&
3132
test -s err
3233
3334
'

transport-helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static void standard_options(struct transport *t)
273273
char buf[16];
274274
int n;
275275
int v = t->verbose;
276-
int no_progress = v < 0 || (!t->progress && !isatty(1));
276+
int no_progress = v < 0 || (!t->progress && !isatty(2));
277277

278278
set_helper_option(t, "progress", !no_progress ? "true" : "false");
279279

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ static int fetch_refs_via_pack(struct transport *transport,
478478
args.include_tag = data->options.followtags;
479479
args.verbose = (transport->verbose > 0);
480480
args.quiet = (transport->verbose < 0);
481-
args.no_progress = args.quiet || (!transport->progress && !isatty(1));
481+
args.no_progress = args.quiet || (!transport->progress && !isatty(2));
482482
args.depth = data->options.depth;
483483

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

transport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct transport {
7474
int (*disconnect)(struct transport *connection);
7575
char *pack_lockfile;
7676
signed verbose : 3;
77-
/* Force progress even if the output is not a tty */
77+
/* Force progress even if stderr is not a tty */
7878
unsigned progress : 1;
7979
/*
8080
* If transport is at least potentially smart, this points to

0 commit comments

Comments
 (0)