@matheusbsbs / matheus-bagliano / commits / a5099bb417
Fork 0

Use '-f' option to point to the .gitmodules file

'git config' has a '-f' option that takes the file to parse. Using it rather than the environment variable seems more logical and simplified. Signed-off-by: Imran M Yousuf <imyousuf@smartitengineering.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Imran M Yousuf committed May 15, 2008 at 13:42 UTC a5099bb4178591d9a16d704c74dba34b92f35861
1 file changed +4 -5
git-submodule.sh
+4 -5
@@ -74,8 +74,7 @@ module_name()
74 {
75 # Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
76 re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
77 - name=$( GIT_CONFIG=.gitmodules \
78 - git config --get-regexp '^submodule\..*\.path$' |
77 + name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
78 sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
79 test -z "$name" &&
80 die "No submodule mapping found in .gitmodules for path '$path'"
@@ -198,8 +197,8 @@ cmd_add()
197 git add "$path" ||
198 die "Failed to add submodule '$path'"
199
201 - GIT_CONFIG=.gitmodules git config submodule."$path".path "$path" &&
202 - GIT_CONFIG=.gitmodules git config submodule."$path".url "$repo" &&
200 + git config -f .gitmodules submodule."$path".path "$path" &&
201 + git config -f .gitmodules submodule."$path".url "$repo" &&
202 git add .gitmodules ||
203 die "Failed to register submodule '$path'"
204 }
@@ -240,7 +239,7 @@ cmd_init()
239 url=$(git config submodule."$name".url)
240 test -z "$url" || continue
241
243 - url=$(GIT_CONFIG=.gitmodules git config submodule."$name".url)
242 + url=$(git config -f .gitmodules submodule."$name".url)
243 test -z "$url" &&
244 die "No url found for submodule path '$path' in .gitmodules"
245