Skip to content

Commit 83a17fa

Browse files
stefanbellergitster
authored andcommitted
t7406: submodule.<name>.update command must not be run from .gitmodules
submodule.<name>.update can be assigned an arbitrary command via setting it to "!command". When this command is found in the regular config, Git ought to just run that command instead of other update mechanisms. However if that command is just found in the .gitmodules file, it is potentially untrusted, which is why we do not run it. Add a test confirming the behavior. Suggested-by: Jonathan Nieder <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 28996ce commit 83a17fa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

t/t7406-submodule-update.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,14 @@ test_expect_success 'submodule update - command in .git/config' '
406406
)
407407
'
408408

409+
test_expect_success 'submodule update - command in .gitmodules is ignored' '
410+
test_when_finished "git -C super reset --hard HEAD^" &&
411+
git -C super config -f .gitmodules submodule.submodule.update "!false" &&
412+
git -C super commit -a -m "add command to .gitmodules file" &&
413+
git -C super/submodule reset --hard $submodulesha1^ &&
414+
git -C super submodule update submodule
415+
'
416+
409417
cat << EOF >expect
410418
Execution of 'false $submodulesha1' failed in submodule path 'submodule'
411419
EOF

0 commit comments

Comments
 (0)