transport-helper: fix remote helper namespace regression

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>

Felipe Contreras committed May 10, 2013 at 07:08 UTC 126aac5cf3b5696481aafe840f8f596653087d8b
3 files changed +21 -2
git-remote-testgit
+6 -1
@@ -97,7 +97,12 @@ do
97 while read ref a b
98 do
99 test $a == $b && continue
100 - echo "ok $ref"
100 + if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
101 + then
102 + echo "ok $ref"
103 + else
104 + echo "error $ref $GIT_REMOTE_TESTGIT_PUSH_ERROR"
105 + fi
106 done
107
108 echo
t/t5801-remote-helpers.sh
+14
@@ -167,6 +167,20 @@ test_expect_success 'push update refs' '
167 )
168 '
169
170 +test_expect_success 'push update refs failure' '
171 + (cd local &&
172 + git checkout update &&
173 + echo "update fail" >>file &&
174 + git commit -a -m "update fail" &&
175 + git rev-parse --verify testgit/origin/heads/update >expect &&
176 + GIT_REMOTE_TESTGIT_PUSH_ERROR="non-fast forward" &&
177 + export GIT_REMOTE_TESTGIT_PUSH_ERROR &&
178 + test_expect_code 1 git push origin update &&
179 + git rev-parse --verify testgit/origin/heads/update >actual &&
180 + test_cmp expect actual
181 + )
182 +'
183 +
184 test_expect_success 'proper failure checks for fetching' '
185 (GIT_REMOTE_TESTGIT_FAILURE=1 &&
186 export GIT_REMOTE_TESTGIT_FAILURE &&
transport-helper.c
+1 -1
@@ -701,7 +701,7 @@ static int push_update_ref_status(struct strbuf *buf,
701
702 (*ref)->status = status;
703 (*ref)->remote_status = msg;
704 - return 0;
704 + return !(status == REF_STATUS_OK);
705 }
706
707 static void push_update_refs_status(struct helper_data *data,