Raw
1 #!/bin/sh
2
3 test_description='forced push to replace commit we do not have'
4
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8 . ./test-lib.sh
9
10 test_expect_success setup '
11
12 >file1 && git add file1 && test_tick &&
13 git commit -m Initial &&
14 git config receive.denyCurrentBranch warn &&
15
16 mkdir another && (
17 cd another &&
18 git init &&
19 git fetch --update-head-ok .. main:main
20 ) &&
21
22 >file2 && git add file2 && test_tick &&
23 git commit -m Second
24
25 '
26
27 test_expect_success 'non forced push should die not segfault' '
28
29 (
30 cd another &&
31 test_must_fail git push .. main:main
32 )
33
34 '
35
36 test_expect_success 'forced push should succeed' '
37
38 (
39 cd another &&
40 git push .. +main:main
41 )
42
43 '
44
45 test_done