Skip to content

Commit f0fd0dc

Browse files
pratham-pcgitster
authored andcommitted
submodule foreach: document '$sm_path' instead of '$path'
As using a variable '$path' may be harmful to users due to capitalization issues, see 64394e3 (git-submodule.sh: Don't use $path variable in eval_gettext string, 2012-04-17). Adjust the documentation to advocate for using $sm_path, which contains the same value. We still make the 'path' variable available and document it as a deprecated synonym of 'sm_path'. Discussed-with: Ramsay Jones <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Prathamesh Chavan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c033a2f commit f0fd0dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Documentation/git-submodule.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,15 @@ information too.
183183

184184
foreach [--recursive] <command>::
185185
Evaluates an arbitrary shell command in each checked out submodule.
186-
The command has access to the variables $name, $path, $sha1 and
186+
The command has access to the variables $name, $sm_path, $sha1 and
187187
$toplevel:
188188
$name is the name of the relevant submodule section in `.gitmodules`,
189-
$path is the name of the submodule directory relative to the
190-
superproject, $sha1 is the commit as recorded in the superproject,
191-
and $toplevel is the absolute path to the top-level of the superproject.
189+
$sm_path is the path of the submodule as recorded in the immediate
190+
superproject, $sha1 is the commit as recorded in the immediate
191+
superproject, and $toplevel is the absolute path to the top-level
192+
of the immediate superproject.
193+
Note that to avoid conflicts with '$PATH' on Windows, the '$path'
194+
variable is now a deprecated synonym of '$sm_path' variable.
192195
Any submodules defined in the superproject but not checked out are
193196
ignored by this command. Unless given `--quiet`, foreach prints the name
194197
of each submodule before evaluating the command.

0 commit comments

Comments
 (0)