git-submodule foreach: export .gitmodules settings as variables
authorW. Trevor King <wking@tremily.us>
Thu, 8 Nov 2012 23:47:18 +0000 (18:47 -0500)
committerW. Trevor King <wking@tremily.us>
Fri, 9 Nov 2012 03:27:50 +0000 (22:27 -0500)
commit2121ce36cf4eb02385255cbd5b0bbd1dcc803113
tree1c737867c0c9de1bd9faecabc8b68c71021b4a56
parentfb2d915cf60160c200b84df88c6112c1c2d4eefd
git-submodule foreach: export .gitmodules settings as variables

This makes it easy to access per-submodule variables.  For example,

  git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) && git pull'

can now be reduced to

  git submodule foreach 'git checkout $submodule_branch && git pull'

Every submodule.<name>.<opt> setting from .gitmodules is available as
a $submodule_<sanitized-opt> variable.  These variables are not
propagated recursively into nested submodules.

Signed-off-by: W. Trevor King <wking@tremily.us>
Based-on-patch-by: Phil Hord <phil.hord@gmail.com>
Documentation/git-submodule.txt
git-sh-setup.sh [changed mode: 0644->0755]
git-submodule.sh
t/t7407-submodule-foreach.sh