diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2014-04-13 00:33:32 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-04-15 01:03:33 +0400 |
commit | 3994e64d77d644df0f290f8bf5210ff0cb0adde2 (patch) | |
tree | c96da81ffda04e1d72e6464589fae51cdc245c78 /t | |
parent | 852e54bc0f8c7a478bf1f3a13b45fdfc6604aba7 (diff) |
transport-helper: fix sync issue on crashes
When a remote helper crashes while pushing we should revert back to the
state before the push, however, it's possible that `git fast-export`
already finished its job, and therefore has exported the marks already.
This creates a synchronization problem because from that moment on
`git fast-{import,export}` will have marks that the remote helper is not
aware of and all further commands fail (if those marks are referenced).
The fix is to tell `git fast-export` to export to a temporary file, and
only after the remote helper has finishes successfully, move to the
final destination.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t5801-remote-helpers.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh index 25fd2e7f46..aa3e223cde 100755 --- a/t/t5801-remote-helpers.sh +++ b/t/t5801-remote-helpers.sh @@ -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 ) ' |