]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5529-push-errors.sh
The third batch
[thirdparty/git.git] / t / t5529-push-errors.sh
1 #!/bin/sh
2
3 test_description='detect some push errors early (before contacting remote)'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success 'setup commits' '
9 test_commit one
10 '
11
12 test_expect_success 'setup remote' '
13 git init --bare remote.git &&
14 git remote add origin remote.git
15 '
16
17 test_expect_success 'setup fake receive-pack' '
18 FAKE_RP_ROOT=$(pwd) &&
19 export FAKE_RP_ROOT &&
20 write_script fake-rp <<-\EOF &&
21 echo yes >"$FAKE_RP_ROOT"/rp-ran
22 exit 1
23 EOF
24 git config remote.origin.receivepack "\"\$FAKE_RP_ROOT/fake-rp\""
25 '
26
27 test_expect_success 'detect missing branches early' '
28 echo no >rp-ran &&
29 echo no >expect &&
30 test_must_fail git push origin missing &&
31 test_cmp expect rp-ran
32 '
33
34 test_expect_success 'detect missing sha1 expressions early' '
35 echo no >rp-ran &&
36 echo no >expect &&
37 test_must_fail git push origin main~2:main &&
38 test_cmp expect rp-ran
39 '
40
41 test_expect_success 'detect ambiguous refs early' '
42 git branch foo &&
43 git tag foo &&
44 echo no >rp-ran &&
45 echo no >expect &&
46 test_must_fail git push origin foo &&
47 test_cmp expect rp-ran
48 '
49
50 test_done