diff options
author | Jeff King <peff@peff.net> | 2016-09-22 01:24:46 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-22 11:22:47 -0700 |
commit | 72c5f88311dab7149fcca1f6029414ccb776fee8 (patch) | |
tree | 1946c5cd7dce0399a852661ad2e35c088184a61e /git-submodule.sh | |
parent | 02c6c14d6c304f094b680f583a1dd6e4fe75736c (diff) | |
download | git-72c5f88311dab7149fcca1f6029414ccb776fee8.tar.gz |
clone: pass --progress decision to recursive submodulesjk/clone-recursive-progress
When cloning with "--recursive", we'd generally expect
submodules to show progress reports if the main clone did,
too.
In older versions of git, this mostly worked out of the
box. Since we show progress by default when stderr is a tty,
and since the child clones inherit the parent stderr, then
both processes would come to the same decision by default.
If the parent clone was asked for "--quiet", we passed down
"--quiet" to the child. However, if stderr was not a tty and
the user specified "--progress", we did not propagate this
to the child.
That's a minor bug, but things got much worse when we
switched recently to submodule--helper's update_clone
command. With that change, the stderr of the child clones
are always connected to a pipe, and we never output
progress at all.
This patch teaches git-submodule and git-submodule--helper
how to pass down an explicit "--progress" flag when cloning.
The clone command then decides to propagate that flag based
on the cloning decision made earlier (which takes into
account isatty(2) of the parent process, existing --progress
or --quiet flags, etc). Since the child processes always run
without a tty on stderr, we don't have to worry about
passing an explicit "--no-progress"; it's the default for
them.
This fixes the recent loss of progress during recursive
clones. And as a bonus, it makes:
git clone --recursive --progress ... 2>&1 | cat
work by triggering progress explicitly in the children.
Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index a1cc71b521..a024a135d6 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -44,6 +44,7 @@ update= prefix= custom_name= depth= +progress= die_if_unmatched () { @@ -498,6 +499,9 @@ cmd_update() -q|--quiet) GIT_QUIET=1 ;; + --progress) + progress="--progress" + ;; -i|--init) init=1 ;; @@ -573,6 +577,7 @@ cmd_update() { git submodule--helper update-clone ${GIT_QUIET:+--quiet} \ + ${progress:+"$progress"} \ ${wt_prefix:+--prefix "$wt_prefix"} \ ${prefix:+--recursive-prefix "$prefix"} \ ${update:+--update "$update"} \ |