transport-helper: fix sync issue on crashes
[gitweb.git] / t / t5801-remote-helpers.sh
index c33cc25805d2a913725355a183118a0dd5547800..aa3e223cde9cbc3c0e7575c834f1435f23620ada 100755 (executable)
@@ -220,6 +220,20 @@ test_expect_success 'push update refs failure' '
        )
 '
 
+clean_mark () {
+       cut -f 2 -d ' ' "$1" |
+       git cat-file --batch-check |
+       grep commit |
+       sort >$(basename "$1")
+}
+
+cmp_marks () {
+       test_when_finished "rm -rf git.marks testgit.marks" &&
+       clean_mark ".git/testgit/$1/git.marks" &&
+       clean_mark ".git/testgit/$1/testgit.marks" &&
+       test_cmp git.marks testgit.marks
+}
+
 test_expect_success 'proper failure checks for fetching' '
        (GIT_REMOTE_TESTGIT_FAILURE=1 &&
        export GIT_REMOTE_TESTGIT_FAILURE &&
@@ -231,10 +245,12 @@ test_expect_success 'proper failure checks for fetching' '
 '
 
 test_expect_success 'proper failure checks for pushing' '
-       (GIT_REMOTE_TESTGIT_FAILURE=1 &&
-       export GIT_REMOTE_TESTGIT_FAILURE &&
-       cd local &&
-       test_must_fail git push --all
+       (cd local &&
+       git checkout -b crash master &&
+       echo crash >>file &&
+       git commit -a -m crash &&
+       test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all &&
+       cmp_marks origin
        )
 '