* [PATCH] git-submodule - Fix errors regarding resolve_relative_url
@ 2008-06-14 17:09 Mark Levedahl
2008-06-14 18:28 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Mark Levedahl @ 2008-06-14 17:09 UTC (permalink / raw)
To: git; +Cc: Mark Levedahl
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>
---
git-submodule.sh | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 4bd2b8e..7cb4edf 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -45,8 +45,10 @@ 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) || {
+ echo >&2 "remote ($remote) does not have a url defined in .git/config"
+ return 1
+ }
url="$1"
while test -n "$url"
do
@@ -178,7 +180,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 1
+ ;;
*)
# Turn the source into an absolute path if
# it is local
@@ -246,7 +249,7 @@ cmd_init()
# Possibly a url relative to parent
case "$url" in
./*|../*)
- url="$(resolve_relative_url "$url")"
+ url=$(resolve_relative_url "$url") || exit 1
;;
esac
--
1.5.6.rc2.67.g19fe3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] git-submodule - Fix errors regarding resolve_relative_url
2008-06-14 17:09 [PATCH] git-submodule - Fix errors regarding resolve_relative_url Mark Levedahl
@ 2008-06-14 18:28 ` Junio C Hamano
2008-06-14 19:36 ` Mark Levedahl
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-06-14 18:28 UTC (permalink / raw)
To: Mark Levedahl; +Cc: git
Mark Levedahl <mlevedahl@gmail.com> writes:
> 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.
Thanks for catching this. But don't you think the first hunk is
unnecessary?
> While we're at it, clean up the quoting on invocation of
> resolve_relative_url as it was wrong.
Yup. if you make it pass through the non-zero exit status that would be
perfect, like this:
realrepo=$(resolve_relative_url "$repo") || exit
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] git-submodule - Fix errors regarding resolve_relative_url
2008-06-14 18:28 ` Junio C Hamano
@ 2008-06-14 19:36 ` Mark Levedahl
0 siblings, 0 replies; 3+ messages in thread
From: Mark Levedahl @ 2008-06-14 19:36 UTC (permalink / raw)
To: gitster; +Cc: git, Mark Levedahl
git-submodule was invoking "die" from within resolve-relative-url, but
the error return was ignored by the callers. Fix this.
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>
---
git-submodule.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 4bd2b8e..9c890d3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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
--
1.5.6.rc2.65.gcb6b9
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-14 19:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 17:09 [PATCH] git-submodule - Fix errors regarding resolve_relative_url Mark Levedahl
2008-06-14 18:28 ` Junio C Hamano
2008-06-14 19:36 ` Mark Levedahl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).