From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Peter Kjellerstedt <peter.kjellerstedt@axis.com>,
Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: [PATCH 2/2] clone: treat "checking connectivity" like other progress
Date: Wed, 18 Sep 2013 16:06:50 -0400 [thread overview]
Message-ID: <20130918200650.GB731@sigill.intra.peff.net> (raw)
In-Reply-To: <20130918200152.GA17074@sigill.intra.peff.net>
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>
---
Though the last paragraph explains why this is OK, it feels a bit
fragile. I wonder if we should hoist the call to transport_set_verbosity
outside the "!is_local" conditional. I do not think it would hurt
anything.
builtin/clone.c | 4 ++--
t/t5702-clone-options.sh | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 8723a3a..7c62298 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -550,12 +550,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"));
}
diff --git a/t/t5702-clone-options.sh b/t/t5702-clone-options.sh
index d3dbdfe..9e24ec8 100755
--- a/t/t5702-clone-options.sh
+++ b/t/t5702-clone-options.sh
@@ -22,7 +22,8 @@ test_expect_success 'redirected clone does not show progress' '
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
'
--
1.8.4.rc4.16.g228394f
next prev parent reply other threads:[~2013-09-18 20:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 16:52 git clone silently aborts if stdout gets a broken pipe Peter Kjellerstedt
2013-09-18 18:45 ` Jeff King
2013-09-18 19:04 ` Jeff King
2013-09-18 19:31 ` Junio C Hamano
2013-09-18 20:01 ` Jeff King
2013-09-18 20:05 ` [PATCH 1/2] clone: send diagnostic messages to stderr Jeff King
2013-09-18 20:06 ` Jeff King [this message]
2013-09-18 20:35 ` [PATCH 3/2] clone: always set transport options Jeff King
2013-09-19 7:54 ` git clone silently aborts if stdout gets a broken pipe Peter Kjellerstedt
2013-09-19 8:35 ` Jeff King
2013-09-19 15:48 ` Peter Kjellerstedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130918200650.GB731@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=peter.kjellerstedt@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).