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

Re: [PATCH] Clarified how "git submodule add" handles relative paths.

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jun 4, 2011, 16:19 UTC
Message-ID
<4DEA5B03.7020704@web.de>
In-Reply-To
<7vhb86a4kt.fsf@alter.siamese.dyndns.org>
Am 04.06.2011 01:16, schrieb Junio C Hamano:
Show 15 quoted lines
> Jens Lehmann <Jens.Lehmann@web.de> writes:
> 
>> Now I understand this issue better I'd vote for leaving the relative url
>> like it is, comment it better in the man page and give a better error
>> message when that happens. After all this issue only surprised a few
>> people, mostly due to the lack of information in the error message and
>> man page, so I'd rather prefer to not change the behavior but the wording.
> 
> The "how about this" patch you are voting against (I am neutral by the
> way) is a response to your earlier "I have three use cases and the current
> implementation is forgetting the third", which in turn was a response to
> my "your third use case does not count, so the updated wording of the
> documentation is wrong---it should say 'do not', not 'cannot'".
> 
> So what should the updated document say?

I think that for the improved error message the v2 of my 'submodule add: improve message when resolving a relative url fails' should be sufficient.

For the documentation I'd propose to apply Marc's 'Clarified how "git submodule add" handles relative paths.' patch with the interdiff below squashed in. It fixes a typo and explains that absolute paths are allowed too (and join case three with the absolute url one by using a "file://" scheme as default, which is what Mark hinted in his email).

If you want me to resend these two as an updated series just let me know. ---------- 8< ----------

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 2294fa6..99d0a83 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -76,9 +76,10 @@ to exist in the superproject. If <path> is not given, the
 "/path/to/repo.git" and "foo" for "host.xz:foo/.git").
 +
 <repository> is the URL of the new submodule's origin repository.
-This may be either an absolute URL, or (if it begins with ./
+This may be either an absolute URL (when the scheme part is not
+specified "file://" is assumed) or (if it begins with ./
 or ../) a URL relative to one of the superproject's remote
-repostories:  If the superprojet's currently checked-out branch tracks
+repostories:  If the superproject's currently checked-out branch tracks
 a remote branch then that remote's URL is used, otherwise the "origin"
 remote's URL is used.  Relative URLs allow users to easily clone the
 superproject and its submodules using a different URL than what the
Previous: Jens LehmannNext: Junio C Hamano
Message 21 of 40 in “Tests for some submodule corner cases.”
  1. 0/2 Tests for some submodule corner cases.Marc Branchaud, May 30, 2011
  2. 1/2 Added a test for "submodule add" using a ../relative/path/to/the/submodule/repoMarc Branchaud, May 30, 2011
  3. 2/2 Added a test for "submodule status" when the submodule's working directory has deleted files.Marc Branchaud, May 30, 2011
  4. Jens LehmannMay 31, 2011
  5. submodule add: improve message when resolving a relative url failsJens Lehmann, May 31, 2011
  6. Marc BranchaudMay 31, 2011
  7. submodule add: improve message when resolving a relative url failsJens Lehmann, May 31, 2011
  8. Phil HordMay 31, 2011
  9. Marc BranchaudJun 1, 2011
  10. Phil HordJul 27, 2011
  11. Marc BranchaudJul 29, 2011
  12. Junio C HamanoMay 31, 2011
  13. Clarified how "git submodule add" handles relative paths.Marc Branchaud, Jun 1, 2011
  14. Junio C HamanoJun 1, 2011
  15. Jens LehmannJun 1, 2011
  16. Junio C HamanoJun 2, 2011
  17. Jens LehmannJun 3, 2011
  18. Junio C HamanoJun 3, 2011
  19. Mark LevedahlJun 4, 2011
  20. Jens LehmannJun 4, 2011
  21. Jens LehmannJun 4, 2011
  22. Junio C HamanoJun 5, 2011
  23. 0/3 submodule add: allow relative repository path even when no url is setJens Lehmann, Jun 6, 2011
  24. 1/3 submodule add: test failure when url is not configured in superprojectJens Lehmann, Jun 6, 2011
  25. 2/3 submodule add: allow relative repository path even when no url is setJens Lehmann, Jun 6, 2011
  26. 0/2 Improve "git submodule add" documentation.Marc Branchaud, Jun 6, 2011
  27. 1/2 More precisely described how "git submodule add" handles relative submodule URLs.Marc Branchaud, Jun 6, 2011
  28. 2/2 Moved paragraph describing the utility of relative submodule URLs.Marc Branchaud, Jun 6, 2011
  29. 3/3 submodule add: clean up duplicated codeJens Lehmann, Jun 6, 2011
  30. Junio C HamanoJun 6, 2011
  31. Marc BranchaudJun 6, 2011
  32. Jens LehmannJun 6, 2011
  33. Jens LehmannJun 7, 2011
  34. Phil HordJun 8, 2011
  35. [PATCHv2] Clarified how "git submodule add" handles relative paths.Marc Branchaud, Jun 2, 2011
  36. Marc BranchaudMay 31, 2011
  37. Jens LehmannMay 31, 2011
  38. Marc BranchaudJun 1, 2011
  39. Junio C HamanoJun 1, 2011
  40. Jens LehmannJun 1, 2011

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.