diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-08-10 22:18:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-08-10 22:18:21 -0700 |
commit | 56b36b834db41ea81066000f02c13ea8d63cbfcb (patch) | |
tree | e8b557acb97ecb607a6d4e647938d00d19f927d4 | |
parent | 14468ab45bae83ad300f17f41fe8fd555329ee5e (diff) | |
parent | 481c7a6db907774d0f06565d00fd06500a7ae7a4 (diff) | |
download | git-56b36b834db41ea81066000f02c13ea8d63cbfcb.tar.gz |
Merge branch 'jk/push-quiet'
* jk/push-quiet:
transport: don't show push status if --quiet is given
transport: pass "quiet" flag to pack-objects
push: add --quiet flag
-rw-r--r-- | builtin-push.c | 1 | ||||
-rw-r--r-- | builtin-send-pack.c | 3 | ||||
-rw-r--r-- | send-pack.h | 1 | ||||
-rw-r--r-- | transport.c | 21 | ||||
-rw-r--r-- | transport.h | 1 |
5 files changed, 26 insertions, 1 deletions
diff --git a/builtin-push.c b/builtin-push.c index 1d92e22f0a..bc0c91aa4e 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -168,6 +168,7 @@ int cmd_push(int argc, const char **argv, const char *prefix) const char *repo = NULL; /* default repository */ struct option options[] = { + OPT_BIT('q', "quiet", &flags, "be quiet", TRANSPORT_PUSH_QUIET), OPT_BIT('v', "verbose", &flags, "be verbose", TRANSPORT_PUSH_VERBOSE), OPT_STRING( 0 , "repo", &repo, "repository", "repository"), OPT_BIT( 0 , "all", &flags, "push all refs", TRANSPORT_PUSH_ALL), diff --git a/builtin-send-pack.c b/builtin-send-pack.c index 47fb9f7baa..37e528e283 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -44,6 +44,7 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext NULL, NULL, NULL, + NULL, }; struct child_process po; int i; @@ -53,6 +54,8 @@ static int pack_objects(int fd, struct ref *refs, struct extra_have_objects *ext argv[i++] = "--thin"; if (args->use_ofs_delta) argv[i++] = "--delta-base-offset"; + if (args->quiet) + argv[i++] = "-q"; memset(&po, 0, sizeof(po)); po.argv = argv; po.in = -1; diff --git a/send-pack.h b/send-pack.h index 1d7b1b3b4f..8b3cf028ed 100644 --- a/send-pack.h +++ b/send-pack.h @@ -3,6 +3,7 @@ struct send_pack_args { unsigned verbose:1, + quiet:1, send_mirror:1, force_update:1, use_thin_pack:1, diff --git a/transport.c b/transport.c index 8a42e76b3e..afec5b731a 100644 --- a/transport.c +++ b/transport.c @@ -667,6 +667,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) { @@ -878,6 +893,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re args.force_update = !!(flags & TRANSPORT_PUSH_FORCE); args.use_thin_pack = data->thin; args.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE); + args.quiet = !!(flags & TRANSPORT_PUSH_QUIET); args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN); ret = send_pack(&args, data->fd, data->conn, remote_refs, @@ -995,6 +1011,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; @@ -1010,7 +1027,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; diff --git a/transport.h b/transport.h index 51b539778c..f1d3ebf674 100644 --- a/transport.h +++ b/transport.h @@ -36,6 +36,7 @@ struct transport { #define TRANSPORT_PUSH_MIRROR 8 #define TRANSPORT_PUSH_VERBOSE 16 #define TRANSPORT_PUSH_PORCELAIN 32 +#define TRANSPORT_PUSH_QUIET 64 /* Returns a transport suitable for the url */ struct transport *transport_get(struct remote *, const char *); |