aboutsummaryrefslogtreecommitdiff
path: root/t/t5801-remote-helpers.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-04-24 12:31:34 -0700
committerJunio C Hamano <gitster@pobox.com>2014-04-24 12:31:34 -0700
commitd508e4a8e2391ae2596403b6478d01cf3d5f928f (patch)
treecfdb8d28f963a2a1295d61f89b2293bb2408ed29 /t/t5801-remote-helpers.sh
parente42552135a2a396f37053a89f44952ea907870b2 (diff)
parent3667a5b67423ff727569628e903146d970b74095 (diff)
downloadgit-d508e4a8e2391ae2596403b6478d01cf3d5f928f.tar.gz
git-d508e4a8e2391ae2596403b6478d01cf3d5f928f.tar.xz
Merge branch 'fc/transport-helper-sync-error-fix'
Make sure the marks are not written out when the transport helper did not finish happily, to avoid leaving a marks file that is out of sync with the reality. * fc/transport-helper-sync-error-fix: t5801 (remote-helpers): cleanup environment sets transport-helper: fix sync issue on crashes transport-helper: trivial cleanup transport-helper: propagate recvline() error pushing remote-helpers: make recvline return an error transport-helper: remove barely used xchgline()
Diffstat (limited to 't/t5801-remote-helpers.sh')
-rwxr-xr-xt/t5801-remote-helpers.sh31
1 files changed, 23 insertions, 8 deletions
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 25fd2e7f4..a00a66076 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -212,19 +212,30 @@ test_expect_success 'push update refs failure' '
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" &&
- export GIT_REMOTE_TESTGIT_PUSH_ERROR &&
- test_expect_code 1 git push origin update &&
+ test_expect_code 1 env GIT_REMOTE_TESTGIT_FAILURE="non-fast forward" \
+ git push origin update &&
git rev-parse --verify testgit/origin/heads/update >actual &&
test_cmp expect actual
)
'
+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 &&
- cd local &&
- test_must_fail git fetch 2> error &&
+ (cd local &&
+ test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&
cat error &&
grep -q "Error while running fast-import" error
)
@@ -232,7 +243,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
)
'