git-commit-vandalism/t/t1021-rerere-in-workdir.sh
Johannes Schindelin 06d531486e t[01]*: adjust the references to the default branch name "main"
Carefully excluding t1309, which sees independent development elsewhere
at the time of writing, we transition above-mentioned tests to the
default branch name `main`. This trick was performed via

	$ (cd t &&
	   sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
		-e 's/Master/Main/g' -e 's/naster/nain/g' -- t[01]*.sh &&
	   git checkout HEAD -- t1309\*)

Note that t5533 contains a variation of the name `master` (`naster`)
that we rename here, too.

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

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
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

59 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
test_description='rerere run in a workdir'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
test_expect_success SYMLINKS setup '
git config rerere.enabled true &&
>world &&
git add world &&
test_tick &&
git commit -m initial &&
echo hello >world &&
test_tick &&
git commit -a -m hello &&
git checkout -b side HEAD^ &&
echo goodbye >world &&
test_tick &&
git commit -a -m goodbye &&
git checkout main
'
test_expect_success SYMLINKS 'rerere in workdir' '
rm -rf .git/rr-cache &&
"$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . work &&
(
cd work &&
test_must_fail git merge side &&
git rerere status >actual &&
echo world >expect &&
test_cmp expect actual
)
'
# This fails because we don't resolve relative symlink in mkdir_in_gitdir()
# For the purpose of helping contrib/workdir/git-new-workdir users, we do not
# have to support relative symlinks, but it might be nicer to make this work
# with a relative symbolic link someday.
test_expect_failure SYMLINKS 'rerere in workdir (relative)' '
rm -rf .git/rr-cache &&
"$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . krow &&
(
cd krow &&
rm -f .git/rr-cache &&
ln -s ../.git/rr-cache .git/rr-cache &&
test_must_fail git merge side &&
git rerere status >actual &&
echo world >expect &&
test_cmp expect actual
)
'
test_done