Subject: Re: [PATCH] modify the “foo" file path to "$PWD/bad-clone/sub/foo".

From: Junio C Hamano <[email-masked]>
Date: Wed, 30 Jul 2025 08:47:16 -0700

"陈建虎 via GitGitGadget" <[email-masked]> writes:

> From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email-masked]>
>
> In the t7450-bad-git-dotfiles.sh, when post-checkout
> is executed, the actual path where the foo file
> is created should be "$PWD/bad-clone/sub/foo".

"is created" is a bit iffy thing to say, as the test actually
expects the path _not_ to exist.

Also, pay special attention to what you say on your Subject: line.

    Can I tell what area the change touches by only looking at the
    Subject: line, especially when it is mixed with dozens of other
    patch e-mails?

is the question any author of a patch e-mail should be asking.

    $ git log --no-merges --format=%s -100 | sort

may give us some inspirations.  For this one, perhaps I would have
written

    Subject: t7450: inspect the correct path a broken code would write to

    Prior to 05e9cd64 (config: quote values containing CR character,
    2025-05-19), a repository can trick "clone --recurse-submodules"
    into running a post-checkout hook shipped with the project.  The
    test was written to make sure the trick would no longer run the
    hook with the fix in the commit.

    However, the test did not check for the path the hook would
    create; correct the path to the expected one if the bug were
    still with us.

or something like that.

Justin, who wrote the test originally, Cc'ed for comments.

Thanks.

> diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
> index 14b5743b962..f512eed278c 100755
> --- a/t/t7450-bad-git-dotfiles.sh
> +++ b/t/t7450-bad-git-dotfiles.sh
> @@ -401,7 +401,7 @@ test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d
>  	git -C repo commit -m submodule &&
>  
>  	git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone &&
> -	! test -f "$PWD/foo" &&
> +	! test -f "$PWD/bad-clone/sub/foo" &&
>  	test -f $(printf "bad-clone/sub\r/post-checkout")
>  '