]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1301: fix wrong template dir for git-init
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Tue, 29 Nov 2022 13:15:09 +0000 (21:15 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Nov 2022 01:21:50 +0000 (10:21 +0900)
The template dir prepared in test case "forced modes" is not used as
expected because a wrong template dir is provided to "git init". This is
because the $CWD for "git-init" command is a sibling directory alongside
the template directory. Change it to the right template directory and
add a protection test using "test_path_is_file".

The wrong template directory was introduced by mistake in commit
e1df7fe43f (init: make --template path relative to $CWD, 2019-05-10).

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1301-shared-repo.sh

index 93a2f91f8a5181c5307c6de14ab6f2823d2b959a..7578e75d779ed5b229a6133f7b8bad704a328683 100755 (executable)
@@ -140,7 +140,8 @@ test_expect_success POSIXPERM 'forced modes' '
        (
                cd new &&
                umask 002 &&
-               git init --shared=0660 --template=templates &&
+               git init --shared=0660 --template=../templates &&
+               test_path_is_file .git/hooks/post-update &&
                >frotz &&
                git add frotz &&
                git commit -a -m initial &&