git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t7406: submodule.<name>.update command must not be run from .gitmodules
@ 2017-09-25 19:55 Stefan Beller
  2017-09-25 20:04 ` Jonathan Nieder
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Beller @ 2017-09-25 19:55 UTC (permalink / raw)
  To: git; +Cc: jrnieder, Stefan Beller

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 <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 t/t7406-submodule-update.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 034914a14f..780af4e6f5 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -406,6 +406,16 @@ test_expect_success 'submodule update - command in .git/config' '
 	)
 '
 
+test_expect_success 'submodule update - command in .gitmodules is ignored' '
+	test_when_finished "git -C super reset --hard HEAD^" &&
+
+	git -C super config -f .gitmodules submodule.submodule.update "!false || echo >bad" &&
+	git -C super commit -a -m "add command to .gitmodules file" &&
+	git -C super/submodule reset --hard $submodulesha1^ &&
+	git -C super submodule update submodule 2>../actual &&
+	test_path_is_missing super/bad
+'
+
 cat << EOF >expect
 Execution of 'false $submodulesha1' failed in submodule path 'submodule'
 EOF
-- 
2.14.0.rc0.3.g6c2e499285


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-09-27  3:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25 19:55 [PATCH] t7406: submodule.<name>.update command must not be run from .gitmodules Stefan Beller
2017-09-25 20:04 ` Jonathan Nieder
2017-09-25 22:50   ` Stefan Beller
2017-09-26  0:01     ` Jonathan Nieder
2017-09-26  5:37     ` Johannes Sixt
2017-09-26  6:28       ` Junio C Hamano
2017-09-26 18:54         ` Stefan Beller
2017-09-26 19:46           ` Johannes Sixt
2017-09-26 19:54             ` Stefan Beller
2017-09-27  3:21               ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).