Skip to content

Commit

Permalink
clone: treat "checking connectivity" like other progress
Browse files Browse the repository at this point in the history
When stderr does not point to a tty, we typically suppress
"we are now in this phase" progress reporting (e.g., we ask
the server not to send us "counting objects" and the like).

The new "checking connectivity" message is in the same vein,
and should be suppressed. Since clone relies on the
transport code to make the decision, we can simply sneak a
peek at the "progress" field of the transport struct. That
properly takes into account both the verbosity and progress
options we were given, as well as the result of isatty().

Note that we do not set up that progress flag for a local
clone, as we do not fetch using the transport at all. That's
acceptable here, though, because we also do not perform a
connectivity check in that case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Sep 18, 2013
1 parent 68b939b commit 2856cbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,12 @@ static void update_remote_refs(const struct ref *refs,
const struct ref *rm = mapped_refs;

if (check_connectivity) {
if (0 <= option_verbosity)
if (transport->progress)
fprintf(stderr, _("Checking connectivity... "));
if (check_everything_connected_with_transport(iterate_ref_map,
0, &rm, transport))
die(_("remote did not send all necessary objects"));
if (0 <= option_verbosity)
if (transport->progress)
fprintf(stderr, _("done\n"));
}

Expand Down
3 changes: 2 additions & 1 deletion t/t5702-clone-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ test_expect_success 'clone -o' '
test_expect_success 'redirected clone does not show progress' '
git clone "file://$(pwd)/parent" clone-redirected >out 2>err &&
! grep % err
! grep % err &&
test_i18ngrep ! "Checking connectivity" err
'

Expand Down

0 comments on commit 2856cbf

Please sign in to comment.