]> git.ipfire.org Git - thirdparty/git.git/blob - t/t5405-send-pack-rewind.sh
The third batch
[thirdparty/git.git] / t / t5405-send-pack-rewind.sh
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_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 test_expect_success setup '
12
13 >file1 && git add file1 && test_tick &&
14 git commit -m Initial &&
15 git config receive.denyCurrentBranch warn &&
16
17 mkdir another && (
18 cd another &&
19 git init &&
20 git fetch --update-head-ok .. main:main
21 ) &&
22
23 >file2 && git add file2 && test_tick &&
24 git commit -m Second
25
26 '
27
28 test_expect_success 'non forced push should die not segfault' '
29
30 (
31 cd another &&
32 test_must_fail git push .. main:main
33 )
34
35 '
36
37 test_expect_success 'forced push should succeed' '
38
39 (
40 cd another &&
41 git push .. +main:main
42 )
43
44 '
45
46 test_done