diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:47:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:47:53 +0000 |
commit | c8bae7493d2f2910b57f13ded012e86bdcfb0532 (patch) | |
tree | 24e09d9f84dec336720cf393e156089ca2835791 /t/t5405-send-pack-rewind.sh | |
parent | Initial commit. (diff) | |
download | git-upstream/1%2.39.2.tar.xz git-upstream/1%2.39.2.zip |
Adding upstream version 1:2.39.2.upstream/1%2.39.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/t5405-send-pack-rewind.sh')
-rwxr-xr-x | t/t5405-send-pack-rewind.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t5405-send-pack-rewind.sh b/t/t5405-send-pack-rewind.sh new file mode 100755 index 0000000..11f0323 --- /dev/null +++ b/t/t5405-send-pack-rewind.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +test_description='forced push to replace commit we do not have' + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +. ./test-lib.sh + +test_expect_success setup ' + + >file1 && git add file1 && test_tick && + git commit -m Initial && + git config receive.denyCurrentBranch warn && + + mkdir another && ( + cd another && + git init && + git fetch --update-head-ok .. main:main + ) && + + >file2 && git add file2 && test_tick && + git commit -m Second + +' + +test_expect_success 'non forced push should die not segfault' ' + + ( + cd another && + test_must_fail git push .. main:main + ) + +' + +test_expect_success 'forced push should succeed' ' + + ( + cd another && + git push .. +main:main + ) + +' + +test_done |