summaryrefslogtreecommitdiff
path: root/transport.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-03-15 07:58:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-15 07:58:24 (GMT)
commit66bce02ec459123d07c3f0230906cc2f8e36504c (patch)
tree53a1699e3cb68ef7483c98bd28cc85e5d3c76738 /transport.c
parent2949151fe9d92b2c3405f188e650d9bb7b46c663 (diff)
parentc296134d038fe6d836fe3848e0b342d920933683 (diff)
downloadgit-66bce02ec459123d07c3f0230906cc2f8e36504c.zip
git-66bce02ec459123d07c3f0230906cc2f8e36504c.tar.gz
git-66bce02ec459123d07c3f0230906cc2f8e36504c.tar.bz2
Merge branch 'ld/push-porcelain'
* ld/push-porcelain: t5516: Use test_cmp when appropriate git-push: add tests for git push --porcelain git-push: make git push --porcelain print "Done" git-push: send "To <remoteurl>" messages to the standard output in --porcelain mode git-push: fix an advice message so it goes to stderr Conflicts: transport.c
Diffstat (limited to 'transport.c')
-rw-r--r--transport.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/transport.c b/transport.c
index f07bd33..825be94 100644
--- a/transport.c
+++ b/transport.c
@@ -673,7 +673,7 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)
static int print_one_push_status(struct ref *ref, const char *dest, int count, int porcelain)
{
if (!count)
- fprintf(stderr, "To %s\n", dest);
+ fprintf(porcelain ? stdout : stderr, "To %s\n", dest);
switch(ref->status) {
case REF_STATUS_NONE:
@@ -789,6 +789,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
args.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE);
args.quiet = !!(flags & TRANSPORT_PUSH_QUIET);
args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);
+ args.porcelain = !!(flags & TRANSPORT_PUSH_PORCELAIN);
ret = send_pack(&args, data->fd, data->conn, remote_refs,
&data->extra_have);
@@ -1049,7 +1050,7 @@ int transport_push(struct transport *transport,
int quiet = flags & TRANSPORT_PUSH_QUIET;
int porcelain = flags & TRANSPORT_PUSH_PORCELAIN;
int pretend = flags & TRANSPORT_PUSH_DRY_RUN;
- int ret, err;
+ int push_ret, ret, err;
if (flags & TRANSPORT_PUSH_ALL)
match_flags |= MATCH_REFS_ALL;
@@ -1065,10 +1066,9 @@ int transport_push(struct transport *transport,
flags & TRANSPORT_PUSH_MIRROR,
flags & TRANSPORT_PUSH_FORCE);
- ret = transport->push_refs(transport, remote_refs, flags);
+ push_ret = transport->push_refs(transport, remote_refs, flags);
err = push_had_errors(remote_refs);
-
- ret |= err;
+ ret = push_ret | err;
if (!quiet || err)
transport_print_push_status(transport->url, remote_refs,
@@ -1084,8 +1084,11 @@ int transport_push(struct transport *transport,
transport_update_tracking_ref(transport->remote, ref, verbose);
}
- if (!quiet && !ret && !transport_refs_pushed(remote_refs))
+ if (porcelain && !push_ret)
+ puts("Done");
+ else if (!quiet && !ret && !transport_refs_pushed(remote_refs))
fprintf(stderr, "Everything up-to-date\n");
+
return ret;
}
return 1;