git/t/t4121-apply-diffs.sh
Johannes Schindelin 8f37854b18 t4*: adjust the references to the default branch name "main"
Carefully excluding t4013 and t4015, which see independent development
elsewhere at the time of writing, we use `main` as the default branch
name in t4*. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -- t4*.sh t4211/*.export &&
	   git checkout HEAD -- t4013\*)

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

35 lines
643 B
Bash
Executable file

#!/bin/sh
test_description='git apply for contextually independent diffs'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
echo '1
2
3
4
5
6
7
8' >file
test_expect_success 'setup' \
'git add file &&
git commit -q -m 1 &&
git checkout -b test &&
mv file file.tmp &&
echo 0 >file &&
cat file.tmp >>file &&
rm file.tmp &&
git commit -a -q -m 2 &&
echo 9 >>file &&
git commit -a -q -m 3 &&
git checkout main'
test_expect_success \
'check if contextually independent diffs for the same file apply' \
'( git diff test~2 test~1 && git diff test~1 test~0 )| git apply'
test_done