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

Re: [RFC/PATCH] clone: introduce clone.submoduleGitDir to relocate $GITDIR

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 15, 2013, 02:48 UTC
Message-ID
<7v61zo4igg.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vy5ck4m6b.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> If the envisioned use of this is to use it as a building block of
> something else that is user-facing (e.g. the user says "git add",
> and before the command finishes, somewhere we internally run "git
> clone"), then would it be possible that you are better off running
> that clone with --separate-git-dir and let it make the gitfile for
> you?

As you may have already guessed, in principle I am all for teaching "git add" not just to add a submodule itself (which we already do) but also to record information about the submodule, without having to delegate it to "git submodule". "git submodule add" was meant as an interim measure until we figure out what kind of metainformation is necessary, and doing things in "git add" has always been a longer term goal.

There are two ways to "add" a submodule to a superproject. You may bring an existing project with "git clone" inside the working tree of a superproject (which I am guessing is the use case that inspired this patch), but it will leave the git dir of the submodule embedded in its working tree.

You could continue "git clone" and then teach "git add" (or "git submodule add") to relocate the embedded git directory from the submodule working tree, you could "git clone" with separate-git-dir from the beginning, or you could extend "git add", perhaps

    git add --url=git://up.stre.am/repository [--name=name] sub/mod/ule

and do that "git clone --separate-git-dir" internally (which will mean that the end user will not run "git clone").

Another way ti "add" a submodule is to run "git init" to originate a new project inside the working tree of a superproject. The resulting submodule working tree will have the embedded git dir, and again "git add" (or "git submodule add") could notice and relocate it, but if the extended "git add" wants to help that use case as well, I think it is the matter of running "git init --separate-git-dir", just like "add by cloning from elsewhere" can do the same with the flag to "git clone".

Previous: Junio C HamanoNext: Ramkumar Ramachandra
Message 3 of 41 in “clone: introduce clone.submoduleGitDir to relocate $GITDIR”
  1. clone: introduce clone.submoduleGitDir to relocate $GITDIRRamkumar Ramachandra, Apr 13, 2013
  2. Junio C HamanoApr 15, 2013
  3. Junio C HamanoApr 15, 2013
  4. Ramkumar RamachandraApr 15, 2013
  5. Junio C HamanoApr 15, 2013
  6. Ramkumar RamachandraApr 15, 2013
  7. Ramkumar RamachandraApr 15, 2013
  8. Ramkumar RamachandraApr 15, 2013
  9. Duy NguyenApr 15, 2013
  10. Ramkumar RamachandraApr 15, 2013
  11. Junio C HamanoApr 15, 2013
  12. Ramkumar RamachandraApr 15, 2013
  13. Marc BranchaudApr 15, 2013
  14. Junio C HamanoApr 15, 2013
  15. Ramkumar RamachandraApr 15, 2013
  16. Jeff KingApr 15, 2013
  17. Junio C HamanoApr 15, 2013
  18. Ramkumar RamachandraApr 16, 2013
  19. Marc BranchaudApr 16, 2013
  20. Marc BranchaudApr 15, 2013
  21. Ramkumar RamachandraApr 16, 2013
  22. Marc BranchaudApr 16, 2013
  23. Marc BranchaudApr 15, 2013
  24. Junio C HamanoApr 15, 2013
  25. Marc BranchaudApr 15, 2013
  26. Junio C HamanoApr 15, 2013
  27. Ramkumar RamachandraApr 16, 2013
  28. Marc BranchaudApr 16, 2013
  29. Ramkumar RamachandraApr 15, 2013
  30. Jonathan NiederApr 16, 2013
  31. Ramkumar RamachandraApr 16, 2013
  32. Junio C HamanoApr 16, 2013
  33. Jonathan NiederApr 17, 2013
  34. Duy NguyenApr 17, 2013
  35. Ramkumar RamachandraApr 17, 2013
  36. Duy NguyenApr 17, 2013
  37. Ramkumar RamachandraApr 17, 2013
  38. Duy NguyenApr 17, 2013
  39. Ramkumar RamachandraApr 17, 2013
  40. Duy NguyenApr 17, 2013
  41. Junio C HamanoApr 17, 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.