summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2008-06-14 13:09:41 -0400
committerJunio C Hamano <gitster@pobox.com>2008-06-14 11:34:00 -0700
commit8e7e6f39b6895b6623dc0f6053818704899f41a6 (patch)
treed4a07d9b10487363cfc785f11f6a3509f14b6285 /git-submodule.sh
parent65e73dba4a7034e299895bed88a8d3e8ca127a11 (diff)
downloadgit-8e7e6f39b6895b6623dc0f6053818704899f41a6.tar.gz
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>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 4032830907..3eb78cc724 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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
@@ -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
@@ -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