]>
Commit | Line | Data |
---|---|---|
6738c819 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='forced push to replace commit we do not have' | |
4 | ||
966b4be2 | 5 | GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main |
334afbc7 JS |
6 | export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME |
7 | ||
1fdd31cf | 8 | TEST_PASSES_SANITIZE_LEAK=true |
6738c819 JH |
9 | . ./test-lib.sh |
10 | ||
11 | test_expect_success setup ' | |
12 | ||
13 | >file1 && git add file1 && test_tick && | |
14 | git commit -m Initial && | |
acd2a45b | 15 | git config receive.denyCurrentBranch warn && |
6738c819 JH |
16 | |
17 | mkdir another && ( | |
18 | cd another && | |
19 | git init && | |
966b4be2 | 20 | git fetch --update-head-ok .. main:main |
6738c819 JH |
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 && | |
966b4be2 | 32 | test_must_fail git push .. main:main |
6738c819 JH |
33 | ) |
34 | ||
35 | ' | |
36 | ||
37 | test_expect_success 'forced push should succeed' ' | |
38 | ||
39 | ( | |
40 | cd another && | |
966b4be2 | 41 | git push .. +main:main |
6738c819 JH |
42 | ) |
43 | ||
44 | ' | |
45 | ||
46 | test_done |