git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix submodule sync with relative submodule URLs

From
David Aguilar <davvid@gmail.com>
Date
Sep 25, 2008, 11:38 UTC
Message-ID
<20080925113849.GA18543@gmail.com>
In-Reply-To
<20080924161902.GT3669@spearce.org>
On  0, "Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 21 quoted lines
> Johan Herland <johan@herland.net> wrote:
> > On Wednesday 24 September 2008, David Aguilar wrote:
> > > 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.

Right, it's not. resolve_relative_url() is already calling die() when that error condition is met, so the "|| exit" thing can be removed entirely. I sent a patch on top of Johan's first patch to remove the "|| exit" calls in all callers of resolve_relative_url. That seems like the right thing to do; in the very least it makes it easier to read. What do you think?

Show 24 quoted lines
> 
> > 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.
-- 
	David
Previous: Johan HerlandNext: David Aguilar
Message 6 of 10 in “Fix submodule sync with relative submodule URLs”
  1. Fix submodule sync with relative submodule URLsJohan Herland, Sep 22, 2008
  2. David AguilarSep 24, 2008
  3. Fix submodule sync with relative submodule URLsJohan Herland, Sep 24, 2008
  4. Shawn O. PearceSep 24, 2008
  5. Johan HerlandSep 24, 2008
  6. David AguilarSep 25, 2008
  7. git-submodule: remove unnecessary exits when calling resolve_relative_urlDavid Aguilar, Sep 25, 2008
  8. Johannes SixtSep 25, 2008
  9. Shawn O. PearceSep 25, 2008
  10. Johan HerlandSep 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.