Skip to content

Commit

Permalink
git-submodule - Fix errors regarding resolve_relative_url
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Levedahl authored and Junio C Hamano committed Jun 14, 2008
1 parent 65e73db commit 8e7e6f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ resolve_relative_url ()
branch="$(git symbolic-ref HEAD 2>/dev/null)"
remote="$(git config branch.${branch#refs/heads/}.remote)"
remote="${remote:-origin}"
remoteurl="$(git config remote.$remote.url)" ||
die "remote ($remote) does not have a url in .git/config"
remoteurl=$(git config "remote.$remote.url") ||
die "remote ($remote) does not have a url defined in .git/config"
url="$1"
while test -n "$url"
do
Expand Down Expand Up @@ -178,7 +178,8 @@ cmd_add()
case "$repo" in
./*|../*)
# dereference source url relative to parent's url
realrepo="$(resolve_relative_url $repo)" ;;
realrepo=$(resolve_relative_url "$repo") || exit
;;
*)
# Turn the source into an absolute path if
# it is local
Expand Down Expand Up @@ -246,7 +247,7 @@ cmd_init()
# Possibly a url relative to parent
case "$url" in
./*|../*)
url="$(resolve_relative_url "$url")"
url=$(resolve_relative_url "$url") || exit
;;
esac

Expand Down

0 comments on commit 8e7e6f3

Please sign in to comment.