git submodule foreach: Provide access to submodule name, as '$name'
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>
This commit is contained in:

committed by
Junio C Hamano

parent
64d5fe0a23
commit
1e7f2aad7d
@ -243,6 +243,7 @@ cmd_foreach()
|
||||
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
|
||||
|
Reference in New Issue
Block a user