diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-06-03 11:15:05 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-06 19:00:21 (GMT) |
commit | 93e02b6e1e845f5178017c0bac4f18077b331499 (patch) | |
tree | afb809773453e6238ed671461cb4f899f27711e2 /t/t2400-worktree-add.sh | |
parent | e942292a3e099f03ae23efd3fd9f09f8b512cadf (diff) | |
download | git-93e02b6e1e845f5178017c0bac4f18077b331499.zip git-93e02b6e1e845f5178017c0bac4f18077b331499.tar.gz git-93e02b6e1e845f5178017c0bac4f18077b331499.tar.bz2 |
tests: don't assume a .git/info for .git/info/grafts
Change those tests that assumed that a .git/info directory would be
created for them when writing .git/info/grafts to explicitly create
the directory.
Do this using the new "TEST_CREATE_REPO_NO_TEMPLATE" facility, and use
"mkdir" instead of "mkdir -p" to assert that we don't have the
.git/info already. An exception to this is the "with grafts" test in
"t6001-rev-list-graft.sh". There we're modifying our ".git" state in a
for-loop, in lieu of refactoring that more extensively let's use
"mkdir -p" there.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2400-worktree-add.sh')
-rwxr-xr-x | t/t2400-worktree-add.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index 2f564d5..f3242fe 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -5,6 +5,7 @@ test_description='test git worktree add' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME +TEST_CREATE_REPO_NO_TEMPLATE=1 . ./test-lib.sh . "$TEST_DIRECTORY"/lib-rebase.sh @@ -229,6 +230,7 @@ test_expect_success 'checkout with grafts' ' SHA1=$(git rev-parse HEAD) && test_commit def && test_commit xyz && + mkdir .git/info && echo "$(git rev-parse HEAD) $SHA1" >.git/info/grafts && cat >expected <<-\EOF && xyz @@ -559,6 +561,8 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' ' ' post_checkout_hook () { + test_when_finished "rm -rf .git/hooks" && + mkdir .git/hooks && test_hook -C "$1" post-checkout <<-\EOF { echo $* |