list mirror (unofficial, one of many)
 help / color / Atom feed
From: Prathamesh Chavan <>
Cc:,,, Prathamesh Chavan <>
Subject: [PATCH v1 4/5] submodule foreach: document variable '$displaypath'
Date: Fri,  2 Feb 2018 10:27:44 +0530
Message-ID: <> (raw)
In-Reply-To: <>

It was observed that the variable '$displaypath' was accessible but
undocumented. Hence, document it.

Discussed-with: Ramsay Jones <>
Signed-off-by: Stefan Beller <>
Signed-off-by: Prathamesh Chavan <>
 Documentation/git-submodule.txt |  6 ++++--
 t/    | 22 +++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 8e7930ebc..0cca702cb 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -183,10 +183,12 @@ information too.
 foreach [--recursive] <command>::
 	Evaluates an arbitrary shell command in each checked out submodule.
-	The command has access to the variables $name, $sm_path, $sha1 and
-	$toplevel:
+	The command has access to the variables $name, $sm_path, $displaypath,
+	$sha1 and $toplevel:
 	$name is the name of the relevant submodule section in `.gitmodules`,
 	$sm_path is the path of the submodule as recorded in the superproject,
+	$displaypath contains the relative path from the current working
+	directory to the submodules root directory,
 	$sha1 is the commit as recorded in the superproject, and
 	$toplevel is the absolute path to its superproject, such that
 	$toplevel/$sm_path is the absolute path of the submodule.
diff --git a/t/ b/t/
index 0663622a4..6ad57e061 100755
--- a/t/
+++ b/t/
@@ -82,16 +82,16 @@ test_expect_success 'test basic "submodule foreach" usage' '
 cat >expect <<EOF
 Entering '../sub1'
 Entering '../sub3'
 test_expect_success 'test "submodule foreach" from subdirectory' '
 	mkdir clone/sub &&
 		cd clone/sub &&
-		git submodule foreach "echo \$toplevel-\$name-\$sm_path-\$sha1" >../../actual
+		git submodule foreach "echo \$toplevel-\$name-\$sm_path-\$displaypath-\$sha1" >../../actual
 	) &&
 	test_i18ncmp expect actual
@@ -206,25 +206,25 @@ submodulesha1=$(cd clone2/nested1/nested2/nested3/submodule && git rev-parse HEA
 cat >expect <<EOF
 Entering '../nested1'
 Entering '../nested1/nested2'
 Entering '../nested1/nested2/nested3'
 Entering '../nested1/nested2/nested3/submodule'
 Entering '../sub1'
 Entering '../sub2'
 Entering '../sub3'
 test_expect_success 'test "submodule foreach --recursive" from subdirectory' '
 		cd clone2/untracked &&
-		git submodule foreach --recursive "echo \$toplevel-\$name-\$sm_path-\$sha1" >../../actual
+		git submodule foreach --recursive "echo \$toplevel-\$name-\$sm_path-\$displaypath-\$sha1" >../../actual
 	) &&
 	test_i18ncmp expect actual

  parent reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02  4:57 [PATCH v1 0/5] Incremental rewrite of git-submodules Prathamesh Chavan
2018-02-02  4:57 ` [PATCH v1 1/5] submodule foreach: correct '$path' in nested submodules from a subdirectory Prathamesh Chavan
2018-02-06 22:54   ` Jonathan Tan
2018-02-06 23:00     ` Jonathan Tan
2018-02-06 23:11     ` Stefan Beller
2018-02-02  4:57 ` [PATCH v1 2/5] submodule foreach: document '$sm_path' instead of '$path' Prathamesh Chavan
2018-02-02  4:57 ` [PATCH v1 3/5] submodule foreach: clarify the '$toplevel' variable documentation Prathamesh Chavan
2018-02-02  4:57 ` Prathamesh Chavan [this message]
2018-02-02  4:57 ` [PATCH v1 5/5] submodule: port submodule subcommand 'foreach' from shell to C Prathamesh Chavan

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 list mirror (unofficial, 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