Skip to content

Commit

Permalink
transport: don't show push status if --quiet is given
Browse files Browse the repository at this point in the history
When --quiet is given, the user generally only wants to see
errors. So let's suppress printing the ref status table
unless there is an error, in which case we print out the
whole table.

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 Aug 6, 2009
1 parent 1207032 commit 481c7a6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,21 @@ static int fetch_refs_via_pack(struct transport *transport,
return (refs ? 0 : -1);
}

static int push_had_errors(struct ref *ref)
{
for (; ref; ref = ref->next) {
switch (ref->status) {
case REF_STATUS_NONE:
case REF_STATUS_UPTODATE:
case REF_STATUS_OK:
break;
default:
return 1;
}
}
return 0;
}

static int refs_pushed(struct ref *ref)
{
for (; ref; ref = ref->next) {
Expand Down Expand Up @@ -1010,6 +1025,7 @@ int transport_push(struct transport *transport,
struct ref *local_refs = get_local_heads();
int match_flags = MATCH_REFS_NONE;
int verbose = flags & TRANSPORT_PUSH_VERBOSE;
int quiet = flags & TRANSPORT_PUSH_QUIET;
int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
int ret;

Expand All @@ -1025,7 +1041,9 @@ int transport_push(struct transport *transport,

ret = transport->push_refs(transport, remote_refs, flags);

print_push_status(transport->url, remote_refs, verbose | porcelain, porcelain);
if (!quiet || push_had_errors(remote_refs))
print_push_status(transport->url, remote_refs,
verbose | porcelain, porcelain);

if (!(flags & TRANSPORT_PUSH_DRY_RUN)) {
struct ref *ref;
Expand Down

0 comments on commit 481c7a6

Please sign in to comment.