3 test_description
='detect some push errors early (before contacting remote)'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup commits' '
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
24 git config remote.origin.receivepack "\"\$FAKE_RP_ROOT/fake-rp\""
27 test_expect_success
'detect missing branches early' '
30 test_must_fail git push origin missing &&
31 test_cmp expect rp-ran
34 test_expect_success
'detect missing sha1 expressions early' '
37 test_must_fail git push origin main~2:main &&
38 test_cmp expect rp-ran
41 test_expect_success
'detect ambiguous refs early' '
46 test_must_fail git push origin foo &&
47 test_cmp expect rp-ran