• Jeff King's avatar
    clone: pass --progress decision to recursive submodules · 72c5f883
    Jeff King authored
    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: default avatarJeff King <peff@peff.net>
    Acked-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    72c5f883
git-submodule.sh 26.7 KB