diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index 979624d0dc..83a8e14c6c 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 remote ref so that git is unable to match the # two refs (viz. local, remote) unless an explicit refspec is provided. git push origin master:retsam diff --git a/transport-helper.c b/transport-helper.c index 7c9b569d94..71a1e50ee7 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -430,6 +430,15 @@ static int push_refs(struct transport *transport, continue; } + if (ref->status != REF_STATUS_NONE) { + /* + * Earlier, the ref was marked not to be pushed, so ignore the ref + * status reported by the remote helper if the latter is 'no match'. + */ + if (status == REF_STATUS_NONE) + continue; + } + ref->status = status; ref->remote_status = msg; }