modify the “foo" file path to "$PWD/bad-clone/sub/foo".
PATCH 1/1 modify the “foo" file path to "$PWD/bad-clone/sub/foo".
From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email protected]>
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".
---
modify the “foo" file path to "$PWD/bad-clone/sub/foo".
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2022%2Fcjhxmx%2Fcjhxmx-git-test-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2022/cjhxmx/cjhxmx-git-test-v1
Pull-Request: https://github.com/git/git/pull/2022
t/t7450-bad-git-dotfiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t7450-bad-git-dotfiles.sh +1 -1
@@ -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") '
base-commit: e813a0200a7121b97fec535f0d0b460b0a33356c
Signature · 1 line
gitgitgadget
Quoted 3 lines · 陈建虎 via GitGitGadget
From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email protected]>
...Signed-off-by chenjianhu <[email protected]>
The author name and signoff name should match. Either “陈建虎” or the (I’m guessing) romanization “chenjianhu” for both.
Signature · 1 line
Kristoffer Haugsbakk
Quoted 7 lines · Kristoffer Haugsbakk
Quoted 3 lines · 陈建虎 via GitGitGadget
From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email protected]>
...Signed-off-by chenjianhu <[email protected]>The author name and signoff name should match. Either “陈建虎” or the (I’m guessing) romanization “chenjianhu” for both.
Yup, either is fine but it would be nicer to non-east-asian friends to use the Anglicized form.
The title is what needs more polish than the name though.
Quoted 5 lines · 陈建虎 via GitGitGadget
From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email protected]>
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.
Quoted 12 lines
t/t7450-bad-git-dotfiles.sh +1
-1@@ -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") '
Quoted 12 lines · Junio C Hamano
Quoted 1 line · 陈建虎 via GitGitGadget
From: =?UTF-8?q?=E9=99=88=E5=BB=BA=E8=99=8E?= <[email protected]>
Justin, who wrote the test originally, Cc'ed for comments.
Quoted 7 lines
t/t7450-bad-git-dotfiles.sh +0
-0@@ -401,7 +401,7 @@ test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d git -C repo commit -m submodule &&
Quoted 3 lines
t/t7450-bad-git-dotfiles.sh test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d · line 404
Quoted 3 lines
t/t7450-bad-git-dotfiles.sh +1
-1git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone && - ! test -f "$PWD/foo" && + ! test -f "$PWD/bad-clone/sub/foo" &&
This assertion is supposed to validate that the post-checkout hook did not execute. The path here is incorrect indeed. I've tested the fix here and it works as expected. Thanks
Quoted 1 line
t/t7450-bad-git-dotfiles.sh test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d · line 405
Quoted 1 line
t/t7450-bad-git-dotfiles.sh +0
-0test -f $(printf "bad-clone/sub\r/post-checkout")
The second assertion here still demonstrates that a file was not checked out into an arbitrary location, which is the root of the problem, and likely why I missed this. Apologies.
-Justin
PATCH v2 1/1 t7450: inspect the correct path a broken code would write to
In reply to 陈建虎 via GitGitGadgetFrom: chenjianhu <[email protected]>
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.
---
modify the “foo" file path to "$PWD/bad-clone/sub/foo".
cc: "Kristoffer Haugsbakk" [email protected] cc: Justin Tobler [email protected]
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2022%2Fcjhxmx%2Fcjhxmx-git-test-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2022/cjhxmx/cjhxmx-git-test-v2
Pull-Request: https://github.com/git/git/pull/2022
Range-diff vs v1:
1: c2d1d8fe884 ! 1: 6434587a075 modify the “foo" file path to "$PWD/bad-clone/sub/foo".
@@
## Metadata ##
-Author: 陈建虎 <[email protected]>
+Author: chenjianhu <[email protected]>
## Commit message ##
- modify the “foo" file path to "$PWD/bad-clone/sub/foo".
+ t7450: inspect the correct path a broken code would write to
- 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".
+ 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.
t/t7450-bad-git-dotfiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t7450-bad-git-dotfiles.sh +1 -1
@@ -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") '
base-commit: e813a0200a7121b97fec535f0d0b460b0a33356c
Signature · 1 line
gitgitgadget
Re: [PATCH v2] t7450: inspect the correct path a broken code would write to
"chenjianhu via GitGitGadget" <[email protected]> writes:
Somehow Justin and Kristoffer are missing from the Cc list.
Quoted 70 lines
From: chenjianhu <[email protected]>
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.
Signed-off-by chenjianhu <[email protected]>---
modify the “foo" file path to "$PWD/bad-clone/sub/foo".cc: "Kristoffer Haugsbakk" [email protected] cc: Justin Tobler [email protected]
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2022%2Fcjhxmx%2Fcjhxmx-git-test-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2022/cjhxmx/cjhxmx-git-test-v2
Pull-Request: https://github.com/git/git/pull/2022Range-diff vs v1:
1:
c2d1d8fe884! 1:6434587a075modify the “foo" file path to "$PWD/bad-clone/sub/foo".
@@
## Metadata ##
-Author: 陈建虎 <[email protected]>
+Author: chenjianhu <[email protected]>## Commit message ##
- modify the “foo" file path to "$PWD/bad-clone/sub/foo".
+ t7450: inspect the correct path a broken code would write to- 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".
+ Prior to05e9cd64(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.Signed-off-by chenjianhu <[email protected]>t/t7450-bad-git-dotfiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)t/t7450-bad-git-dotfiles.sh +1
-1@@ -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") 'base-commit:
e813a0200a7121b97fec535f0d0b460b0a33356c
Re: [PATCH v2] t7450: inspect the correct path a broken code would write to
In reply to chenjianhu via GitGitGadgetQuoted 7 lines · chenjianhu via GitGitGadget
From: chenjianhu <[email protected]>
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.
Yep the first assertion in the test exists to ensure that the post-checkout hook in the submodule is not executed. The test also validates via its second assertion that the sumodule cannot be tricked into being checked-out into a symlinked directory.
Quoted 6 lines
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.
Signed-off-by chenjianhu <[email protected]>---
[snip]
t/t7450-bad-git-dotfiles.sh test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d · line 404
Quoted 10 lines
t/t7450-bad-git-dotfiles.sh +1
-1@@ -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" &&
Yep, this is the correct path now.
This patch looks good to me. Thanks for fixing :)
-Justin
Quoted 8 lines
t/t7450-bad-git-dotfiles.sh +0
-0test -f $(printf "bad-clone/sub\r/post-checkout") 'base-commit:
e813a0200a7121b97fec535f0d0b460b0a33356cSignature · 1 line
gitgitgadget