This patch modifies the module_name function in git-submodule.sh to take an optional parameter which specifies the path of the .gitmodules file to read. Signed-off-by: Peter Collingbourne <peter@xxxxxxxxx> --- git-submodule.sh | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index f1e4e22..75c50b8 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -64,12 +64,18 @@ module_list() # Map submodule path to submodule name # # $1 = path +# $2 = .gitmodules file, default ".gitmodules" # module_name() { + modfile="$2" + if test -z "$modfile" + then + modfile=".gitmodules" + fi # Do we have "submodule.<something>.path = $1" defined in .gitmodules file? re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g') - name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | + name=$( git config -f "$modfile" --get-regexp '^submodule\..*\.path$' | sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) test -z "$name" && die "No submodule mapping found in .gitmodules for path '$path'" -- 1.6.5 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html