]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5405-send-pack-rewind.sh
The third batch
[thirdparty/git.git] / t / t5405-send-pack-rewind.sh
CommitLineData
6738c819
JH
1#!/bin/sh
2
3test_description='forced push to replace commit we do not have'
4
966b4be2 5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
1fdd31cf 8TEST_PASSES_SANITIZE_LEAK=true
6738c819
JH
9. ./test-lib.sh
10
11test_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
28test_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
37test_expect_success 'forced push should succeed' '
38
39 (
40 cd another &&
966b4be2 41 git push .. +main:main
6738c819
JH
42 )
43
44'
45
46test_done