ci: fix setup of custom path for GitLab CI
[alt-git.git] / t / t5529-push-errors.sh
blob0247137cb36474c22f6ce5ed045379fa43f1a3ea
1 #!/bin/sh
3 test_description='detect some push errors early (before contacting remote)'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup commits' '
9 test_commit one
12 test_expect_success 'setup remote' '
13 git init --bare remote.git &&
14 git remote add origin remote.git
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\""
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
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
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
50 test_done