1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-20 13:26:08 +02:00
git/t/t5405-send-pack-rewind.sh
Johannes Schindelin 966b4be276 t5[0-4]*: adjust the references to the default branch name "main"
Carefully excluding t5310, which is developed independently of the
current patch series at the time of writing, we now use `main` as
default branch in t5[0-4]*. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t5[0-4]*.sh &&
	   git checkout HEAD -- t5310\*)

This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main`
for those tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-19 15:44:18 -08:00

46 lines
732 B
Bash
Executable File

#!/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