summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64d5fe0)
raw | patch | inline | side by side (parent: 64d5fe0)
author | Johan Herland <johan@herland.net> | |
Sun, 16 Aug 2009 01:10:08 +0000 (03:10 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Aug 2009 19:27:57 +0000 (12:27 -0700) |
The argument to 'git submodule foreach' already has access to the variables
'$path' (the path to the submodule, relative to the superproject) and '$sha1'
(the submodule commit recorded by the superproject).
This patch adds another variable -- '$name' -- which contains the name of the
submodule, as recorded in the superproject's .gitmodules file.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'$path' (the path to the submodule, relative to the superproject) and '$sha1'
(the submodule commit recorded by the superproject).
This patch adds another variable -- '$name' -- which contains the name of the
submodule, as recorded in the superproject's .gitmodules file.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-submodule.txt | patch | blob | history | |
git-submodule.sh | patch | blob | history |
index 7dd73ae14eb38fd5bd291c2251f64768d198ebe5..97c32fe264aa5f4f8abbf5361fa509a2ccbff48a 100644 (file)
foreach::
Evaluates an arbitrary shell command in each checked out submodule.
- The command has access to the variables $path and $sha1:
+ The command has access to the variables $name, $path and $sha1:
+ $name is the name of the relevant submodule section in .gitmodules,
$path is the name of the submodule directory relative to the
superproject, and $sha1 is the commit as recorded in the superproject.
Any submodules defined in the superproject but not checked out are
diff --git a/git-submodule.sh b/git-submodule.sh
index ebed711da41a7ac3c4caa7ae9b7f73e0c75f4fe7..d8ecdb91fe1f30f96c3aba1b5b8c36a965d8d89b 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
if test -e "$path"/.git
then
say "Entering '$path'"
+ name=$(module_name "$path")
(cd "$path" && eval "$@") ||
die "Stopping at '$path'; script returned non-zero status."
fi