If the status of a ref is REF_STATUS_REJECT_NONFASTFORWARD or REF_STATUS_UPTODATE, the remote helper will not be told to push the ref (via a 'push' command). Therefore, if a ref is not to be pushed, ignore the status report by the remote helper for that ref - don't overwrite the status of the ref with the status reported by the helper, nor the message in the remote_status member. Signed-off-by: Tay Ray Chuan <rctay89@xxxxxxxxx> --- t/t5541-http-push.sh | 2 +- transport-helper.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index fee9494..79867bc 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -111,7 +111,7 @@ Merge the remote changes before pushing again. See the '"'non-fast-forward'"' section of '"'git push --help'"' for details." output ' -test_expect_failure 'push fails for non-fast-forward refs unmatched by remote helper' ' +test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' ' # create a dissimilarly-named ref so that git is unable to match the refs git push origin master:retsam diff --git a/transport-helper.c b/transport-helper.c index 6b1f778..bdfa07e 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -429,8 +429,18 @@ static int push_refs(struct transport *transport, continue; } - ref->status = status; - ref->remote_status = msg; + switch (ref->status) { + case REF_STATUS_REJECT_NONFASTFORWARD: + case REF_STATUS_UPTODATE: + /* + * Earlier, the ref was marked not to be pushed, so ignore what + * the remote helper said about the ref. + */ + continue; + default: + ref->status = status; + ref->remote_status = msg; + } } strbuf_release(&buf); return 0; -- 1.6.6.rc1.249.g048b3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html