Re: [PATCH] Fix submodule sync with relative submodule URLs
From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:45:24
Johan Herland [off-list ref] wrote:
On Wednesday 24 September 2008, David Aguilar wrote:quoted
Instead of just doing an "|| exit" shouldn't it report an explanation of the error? Other than that, it looks good to me.Fixed. Thanks.
OK, time for the drive-by patch commenting. I've largely stayed
out of git-submodule related code, but I just looked at in the
context of applying this patch.
There are three callers to resolve_relative_url in master and next.
All three callers just "|| exit" when resolve_relative_url fails.
The only reason resolve_relative_url can fail is when there is no
remote.$remote.url configuration option set for the current default
remote ("origin"?).
I guess I'm unclear about why cmd_sync is different from the
existing callers.
quoted hunk ↗ jump to hunk
diff --git a/git-submodule.sh b/git-submodule.sh index 1c39b59..f89bdbe 100755 --- a/git-submodule.sh +++ b/git-submodule.sh@@ -634,6 +634,15 @@ cmd_sync() do name=$(module_name "$path") url=$(git config -f .gitmodules --get submodule."$name".url) + + # Possibly a url relative to parent + case "$url" in + ./*|../*) + url=$(resolve_relative_url "$url") || + die "failed to resolve relative submodule url for '$name'" + ;; + esac + if test -e "$path"/.git then (
-- Shawn.