transport-helper: fix sync issue on crashes
[gitweb.git] / t / t5801-remote-helpers.sh
index 25fd2e7f46cb559372125e08671445476cbf6022..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 &&
@@ -232,7 +246,11 @@ test_expect_success 'proper failure checks for fetching' '
 
 test_expect_success 'proper failure checks for pushing' '
        (cd local &&
-       test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all
+       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
        )
 '