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
This commit is contained in:
commit
42aac96763
@ -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::
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
'
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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++)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user