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
This commit is contained in:
commit
56b36b834d
@ -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),
|
||||
|
@ -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;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
struct send_pack_args {
|
||||
unsigned verbose:1,
|
||||
quiet:1,
|
||||
send_mirror:1,
|
||||
force_update:1,
|
||||
use_thin_pack:1,
|
||||
|
21
transport.c
21
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;
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user