3 test_description='detect some push errors early (before contacting remote)'
6 test_expect_success 'setup commits' '
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
22 git config remote.origin.receivepack "\"\$FAKE_RP_ROOT/fake-rp\""
25 test_expect_success 'detect missing branches early' '
28 test_must_fail git push origin missing &&
29 test_cmp expect rp-ran
32 test_expect_success 'detect missing sha1 expressions early' '
35 test_must_fail git push origin main~2:main &&
36 test_cmp expect rp-ran
39 test_expect_success 'detect ambiguous refs early' '
44 test_must_fail git push origin foo &&
45 test_cmp expect rp-ran