Merge branch 'jk/complete-checkout-sans-dwim-remote'
[git/gitweb.git] / t / t5529-push-errors.sh
blob9871307fd48e3c5da2999d62b02c2c32cb24511a
1 #!/bin/sh
3 test_description='detect some push errors early (before contacting remote)'
4 . ./test-lib.sh
6 test_expect_success 'setup commits' '
7 test_commit one
10 test_expect_success 'setup remote' '
11 git init --bare remote.git &&
12 git remote add origin remote.git
15 test_expect_success 'setup fake receive-pack' '
16 FAKE_RP_ROOT=$(pwd) &&
17 export FAKE_RP_ROOT &&
18 write_script fake-rp <<-\EOF &&
19 echo yes >"$FAKE_RP_ROOT"/rp-ran
20 exit 1
21 EOF
22 git config remote.origin.receivepack "\"\$FAKE_RP_ROOT/fake-rp\""
25 test_expect_success 'detect missing branches early' '
26 echo no >rp-ran &&
27 echo no >expect &&
28 test_must_fail git push origin missing &&
29 test_cmp expect rp-ran
32 test_expect_success 'detect missing sha1 expressions early' '
33 echo no >rp-ran &&
34 echo no >expect &&
35 test_must_fail git push origin master~2:master &&
36 test_cmp expect rp-ran
39 test_expect_success 'detect ambiguous refs early' '
40 git branch foo &&
41 git tag foo &&
42 echo no >rp-ran &&
43 echo no >expect &&
44 test_must_fail git push origin foo &&
45 test_cmp expect rp-ran
48 test_done