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

Re: What's cooking in git.git (May 2013, #09; Wed, 29)

From
John Keeping <john@keeping.me.uk>
Date
Jun 4, 2013, 22:04 UTC
Message-ID
<20130604220418.GP1072@serenity.lan>
In-Reply-To
<51AE5E8D.7080007@web.de>
On Tue, Jun 04, 2013 at 11:39:25PM +0200, Jens Lehmann wrote:
Show 51 quoted lines
> Am 04.06.2013 14:48, schrieb John Keeping:
> > The problem is that sometimes you do want to adjust the path and
> > sometimes you don't.  Reading git-submodule(1), it says:
> > 
> >      This may be either an absolute URL, or (if it begins with ./ or
> >      ../), the location relative to the superproject’s origin
> >      repository.
> >      [snip]
> >      If the superproject doesn’t have an origin configured the
> >      superproject is its own authoritative upstream and the current
> >      working directory is used instead.
> > 
> > So I think it's quite reasonable to have a server layout that looks like
> > this:
> > 
> >     project
> >     |- libs
> >     |  |- libA
> >     |  `- libB
> >     |- core.git
> > 
> > and with only core.git on your local system do:
> > 
> >     cd core/libs
> >     git submodule add ../libs/libB
> > 
> > expecting that to point to libB.  But if we adjust the path then the
> > user has to do:
> > 
> >     git submodule add ../../libs/libB
> > 
> > However, it is also perfectly reasonable to have no remote configured
> > and the library next to the repository itself.  In which case we do want
> > to specify the additional "../" so that shell completion works in the
> > natural way.
> 
> Exactly.
> 
> > The only way I can see to resolve the ambiguity is to die when we hit
> > this particular case.
> 
> Hmm, I'm not so sure about that. Don't the first three lines in
> resolve_relative_url() show how to distinguish between these two
> cases?
>
> resolve_relative_url ()
> {
> 	remote=$(get_default_remote)
> 	remoteurl=$(git config "remote.$remote.url") ||
> 		remoteurl=$(pwd) # the repository is its own authoritative upstream
> ...

If it's this simple, yes. But I think there's also a third possibility that combines both of these: what if the local directory structure is the same as that on the "origin" remote? Then "origin" exists but we still want to adjust for the subdirectory.

The risk is that I can't see a behaviour that doesn't seem to choose whether to convert the given path or not arbitrarily. Even knowing the rules, I expect that I could end up being surprised by this if I create a new repository and haven't set up "origin" yet.

Previous: Jens LehmannNext: Phil Hord
Message 20 of 23 in “What's cooking in git.git (May 2013, #09; Wed, 29)”
  1. Junio C HamanoMay 29, 2013
  2. Thomas RastMay 30, 2013
  3. Ramkumar RamachandraMay 30, 2013
  4. Junio C HamanoJun 2, 2013
  5. Jens LehmannMay 30, 2013
  6. Junio C HamanoJun 2, 2013
  7. Jens LehmannJun 3, 2013
  8. Junio C HamanoJul 1, 2013
  9. Jens LehmannMay 30, 2013
  10. John KeepingMay 31, 2013
  11. John KeepingJun 3, 2013
  12. Junio C HamanoJun 3, 2013
  13. Jens LehmannJun 3, 2013
  14. John KeepingJun 3, 2013
  15. Heiko VoigtJun 4, 2013
  16. John KeepingJun 4, 2013
  17. Heiko VoigtJun 4, 2013
  18. John KeepingJun 4, 2013
  19. Jens LehmannJun 4, 2013
  20. John KeepingJun 4, 2013
  21. Phil HordJun 4, 2013
  22. John KeepingJun 5, 2013
  23. Øystein WalleMay 31, 2013

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.