Skip to content

Commit

Permalink
transport-helper.c::push_refs(): ignore helper-reported status if ref…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Tay Ray Chuan authored and Junio C Hamano committed Jan 10, 2010
1 parent 4232826 commit 08d63a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion t/t5541-http-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 08d63a4

Please sign in to comment.