]>
Commit | Line | Data |
---|---|---|
ba928c13 JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='detect some push errors early (before contacting remote)' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success 'setup commits' ' | |
7 | test_commit one | |
8 | ' | |
9 | ||
10 | test_expect_success 'setup remote' ' | |
11 | git init --bare remote.git && | |
12 | git remote add origin remote.git | |
13 | ' | |
14 | ||
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\"" | |
23 | ' | |
24 | ||
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 | |
30 | ' | |
31 | ||
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 | |
37 | ' | |
38 | ||
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 | |
46 | ' | |
47 | ||
48 | test_done |