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.contre...@gmail.com>
---

The regression is in 'next' so far.

 git-remote-testgit.sh     |  7 ++++++-
 t/t5801-remote-helpers.sh | 13 +++++++++++++
 transport-helper.c        |  2 +-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/git-remote-testgit.sh b/git-remote-testgit.sh
index e83315f..2109070 100755
--- a/git-remote-testgit.sh
+++ b/git-remote-testgit.sh
@@ -104,7 +104,12 @@ do
                        *" $ref $a "*)
                                continue ;;     # unchanged
                        esac
-                       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
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 352115c..fa72181 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -182,6 +182,19 @@ 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" \
+       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 &&
diff --git a/transport-helper.c b/transport-helper.c
index f11d78a..2f5ac3f 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -705,7 +705,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,
-- 
1.8.3.rc1.579.g184e698

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to