@matheusbsbs / matheus-bagliano / commits / 8e7e6f39b6
Fork 0

git-submodule - Fix errors regarding resolve_relative_url

git-submodule was invoking "die" from within resolve-relative-url, but this does not actually cause the script to exit. Fix this by returning the error to the caller and have the caller exit. While we're at it, clean up the quoting on invocation of resolve_relative_url as it was wrong. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mark Levedahl committed Jun 14, 2008 at 13:09 UTC 8e7e6f39b6895b6623dc0f6053818704899f41a6
1 file changed +5 -4
git-submodule.sh
+5 -4
@@ -45,8 +45,8 @@ resolve_relative_url ()
45 branch="$(git symbolic-ref HEAD 2>/dev/null)"
46 remote="$(git config branch.${branch#refs/heads/}.remote)"
47 remote="${remote:-origin}"
48 - remoteurl="$(git config remote.$remote.url)" ||
49 - die "remote ($remote) does not have a url in .git/config"
48 + remoteurl=$(git config "remote.$remote.url") ||
49 + die "remote ($remote) does not have a url defined in .git/config"
50 url="$1"
51 while test -n "$url"
52 do
@@ -178,7 +178,8 @@ cmd_add()
178 case "$repo" in
179 ./*|../*)
180 # dereference source url relative to parent's url
181 - realrepo="$(resolve_relative_url $repo)" ;;
181 + realrepo=$(resolve_relative_url "$repo") || exit
182 + ;;
183 *)
184 # Turn the source into an absolute path if
185 # it is local
@@ -246,7 +247,7 @@ cmd_init()
247 # Possibly a url relative to parent
248 case "$url" in
249 ./*|../*)
249 - url="$(resolve_relative_url "$url")"
250 + url=$(resolve_relative_url "$url") || exit
251 ;;
252 esac
253