]> git.ipfire.org Git - thirdparty/git.git/commit - git-submodule.sh
clone: pass --progress decision to recursive submodules
authorJeff King <peff@peff.net>
Thu, 22 Sep 2016 05:24:46 +0000 (01:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Sep 2016 18:22:47 +0000 (11:22 -0700)
commit72c5f88311dab7149fcca1f6029414ccb776fee8
tree1946c5cd7dce0399a852661ad2e35c088184a61e
parent02c6c14d6c304f094b680f583a1dd6e4fe75736c
clone: pass --progress decision to recursive submodules

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>
builtin/clone.c
builtin/submodule--helper.c
git-submodule.sh