@matheusbsbs / matheus-bagliano / commits / 08d63a422b
Fork 0

transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed

If the status of a ref is REF_STATUS_NONE, the remote helper will not be told to push the ref (via a 'push' command). However, the remote helper may still act on these refs. If the helper does act on the ref, and prints a status for it, ignore the report (ie. don't overwrite the status of the ref with it, nor the message in the remote_status member) if the reported status is 'no match'. This allows the user to be alerted to more "interesting" ref statuses, like REF_STATUS_NONFASTFORWARD. Cc: Jeff King <peff@peff.net> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tay Ray Chuan committed Jan 8, 2010 at 10:12 UTC 08d63a422ba7293119865e6cbbc3a34619be32f7
2 files changed +10 -1
t/t5541-http-push.sh
+1 -1
@@ -111,7 +111,7 @@ Merge the remote changes before pushing again. See the '"'non-fast-forward'"'
111 section of '"'git push --help'"' for details." output
112 '
113
114 -test_expect_failure 'push fails for non-fast-forward refs unmatched by remote helper' '
114 +test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
115 # create a dissimilarly-named remote ref so that git is unable to match the
116 # two refs (viz. local, remote) unless an explicit refspec is provided.
117 git push origin master:retsam
transport-helper.c
+9
@@ -430,6 +430,15 @@ static int push_refs(struct transport *transport,
430 continue;
431 }
432
433 + if (ref->status != REF_STATUS_NONE) {
434 + /*
435 + * Earlier, the ref was marked not to be pushed, so ignore the ref
436 + * status reported by the remote helper if the latter is 'no match'.
437 + */
438 + if (status == REF_STATUS_NONE)
439 + continue;
440 + }
441 +
442 ref->status = status;
443 ref->remote_status = msg;
444 }