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

Re: [PATCH] fix "git-submodule add a/b/c/repository"

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Jul 8, 2008, 03:26 UTC
Message-ID
<4872DE54.5010804@gmail.com>
In-Reply-To
<7v7ibxxfje.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 6 quoted lines
> I'd like to hear clarifications on two counts, please?
>  (1) If Sylvain wanted to have that appear at dir0/dir1/init not init,
>      would it have been sufficient to give that path twice (once for
>      <repository> and another for <path> parameter) to make things work as
>      expected?
>   
git-submodule really requires two arguments:
    $ git submodule add <URL> <relative-path-to-module-in-tree>
and supports two modes:
1) relative-path exists and is a valid repo: just add the module, it was 
created in tree, the user is expected to eventually push this to the 
given URL so other users will get this as normal. This exists to 
simplify the process of creating a repo to begin with.
2) relative-path doesn't exist: clone from the URL. This is the normal use.
submodule supports adding a module in one of two ways:
So,
    $ git submodule add   dir0/dir1/init   dir0/dir1/init

will add the repo, but also makes the repo its own origin. I don't think this makes sense.

Show 10 quoted lines
>  (2) Is it generally considered a sane use case to specify an existing
>      repository inside the working tree of a superproject as a submodule
>      using "git submodule add" like Sylvain's example did?
>
>      I would have understood if the command were "git add dir0/dir1/init",
>      but I have this vague recolleciton that "git submodule add" is about
>      telling our repository about a submodule that comes from _outside_.
>
>
>   
Adding an existing in-tree repo, ala
 $ git submodule add <intended-URL> <path>

is there to ease the initial creation of a submodule. It can be created and registered in-tree, and later pushed to the server. This is sane, but is not the normal usage (makes sense only on creation).

Mark
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 15 in “fix "git-submodule add a/b/c/repository"”
  1. fix "git-submodule add a/b/c/repository"Sylvain Joyeux, Jul 1, 2008
  2. Junio C HamanoJul 6, 2008
  3. Sylvain JoyeuxJul 6, 2008
  4. Mark LevedahlJul 6, 2008
  5. Sylvain JoyeuxJul 7, 2008
  6. Mark LevedahlJul 8, 2008
  7. Junio C HamanoJul 8, 2008
  8. Mark LevedahlJul 8, 2008
  9. Junio C HamanoJul 8, 2008
  10. Mark LevedahlJul 8, 2008
  11. git-submodule - make "submodule add" more strict, and document itMark Levedahl, Jul 9, 2008
  12. Junio C HamanoJul 9, 2008
  13. git-submodule - make "submodule add" more strict, and document itMark Levedahl, Jul 10, 2008
  14. git-submodule - register submodule URL if adding in placeMark Levedahl, Jul 10, 2008
  15. Sylvain JoyeuxJul 8, 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.