mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <>
Subject: [PATCH] t7406: submodule.<name>.update command must not be run from .gitmodules
Date: Tue, 26 Sep 2017 11:54:13 -0700
Message-ID: <> (raw)
In-Reply-To: <>

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 <>
Signed-off-by: Stefan Beller <>

Johannes wrote:
> I am pretty confident that this does not test what you intend to
> test. Notice that $TEST_DIRECTORY is expanded when the script is
> written. But that path contains a blank, and we have something like
> this in the test script:
>       #!/bin/sh
>       >/the/build/directory/t/trash directory.t7406/bad

I can confirm that.

Instead of mucking around with writing a script, "to make it robust",
I decided to got the simplest route and just have the command "!false",
which would make "git submodule update submodule" return an error.


 t/ | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/t/ b/t/
index 034914a14f..a9ea098e55 100755
--- a/t/
+++ b/t/
@@ -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" &&
+	git -C super commit -a -m "add command to .gitmodules file" &&
+	git -C super/submodule reset --hard $submodulesha1^ &&
+	git -C super submodule update submodule &&
+	test_path_is_missing bad
 cat << EOF >expect
 Execution of 'false $submodulesha1' failed in submodule path 'submodule'

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 19:55 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 [this message]
2017-09-26 19:46           ` Johannes Sixt
2017-09-26 19:54             ` Stefan Beller
2017-09-27  3:21               ` Junio C Hamano

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:
       or Tor2web:

AGPL code for this site: git clone public-inbox