]>
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 | ||
6738c819 JH |
8 | . ./test-lib.sh |
9 | ||
10 | test_expect_success setup ' | |
11 | ||
12 | >file1 && git add file1 && test_tick && | |
13 | git commit -m Initial && | |
acd2a45b | 14 | git config receive.denyCurrentBranch warn && |
6738c819 JH |
15 | |
16 | mkdir another && ( | |
17 | cd another && | |
18 | git init && | |
966b4be2 | 19 | git fetch --update-head-ok .. main:main |
6738c819 JH |
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 && | |
966b4be2 | 31 | test_must_fail git push .. main:main |
6738c819 JH |
32 | ) |
33 | ||
34 | ' | |
35 | ||
36 | test_expect_success 'forced push should succeed' ' | |
37 | ||
38 | ( | |
39 | cd another && | |
966b4be2 | 40 | git push .. +main:main |
6738c819 JH |
41 | ) |
42 | ||
43 | ' | |
44 | ||
45 | test_done |