Skip to content

Commit

Permalink
transport-helper: fix remote helper namespace regression
Browse files Browse the repository at this point in the history
Commit 664059f (transport-helper: update remote helper namespace)
updates the namespace when the push succeeds or not; we should do it
only when it succeeded.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed May 10, 2013
1 parent d6ae7b2 commit 126aac5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion git-remote-testgit
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ do
while read ref a b
do
test $a == $b && continue
echo "ok $ref"
if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
then
echo "ok $ref"
else
echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
fi
done

echo
Expand Down
14 changes: 14 additions & 0 deletions t/t5801-remote-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ test_expect_success 'push update refs' '
)
'

test_expect_success 'push update refs failure' '
(cd local &&
git checkout update &&
echo "update fail" >>file &&
git commit -a -m "update fail" &&
git rev-parse --verify testgit/origin/heads/update >expect &&
GIT_REMOTE_TESTGIT_PUSH_ERROR="non-fast forward" &&
export GIT_REMOTE_TESTGIT_PUSH_ERROR &&
test_expect_code 1 git push origin update &&
git rev-parse --verify testgit/origin/heads/update >actual &&
test_cmp expect actual
)
'

test_expect_success 'proper failure checks for fetching' '
(GIT_REMOTE_TESTGIT_FAILURE=1 &&
export GIT_REMOTE_TESTGIT_FAILURE &&
Expand Down
2 changes: 1 addition & 1 deletion transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ static int push_update_ref_status(struct strbuf *buf,

(*ref)->status = status;
(*ref)->remote_status = msg;
return 0;
return !(status == REF_STATUS_OK);
}

static void push_update_refs_status(struct helper_data *data,
Expand Down

0 comments on commit 126aac5

Please sign in to comment.