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

Re: nested git repos (not submodules)

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Feb 10, 2012, 22:30 UTC
Message-ID
<4F359AA1.2000901@gmail.com>
In-Reply-To
<7vd39ns4py.fsf@alter.siamese.dyndns.org>
On 2/9/2012 10:16 PM, Junio C Hamano wrote:
Show 11 quoted lines
>
> The repository controlled by worktree/.git should behave as if subdir/
> does not exist, except that obviously the project cannot have a regular
> file "subdir" in it.  When you chdir to worktree/subdir, everything in
> there should behave as if worktree/.git directory does not exist.
>
> At least that is the design, and it indeed is how I arrange my primary
> working tree (I have two "clones" at /git/git.git/ and /git/git.git/Meta,
> and the latter has a checkout of the "todo" branch), so I would make
> noises about any breakage for such a layout.
>

I now see that most of the concept of "a repo worktree path with an o/s subdir containing another repo" is valid provided that the repo is ignoring the worktree of the subdir repo.

Show 6 quoted lines
> I do not know offhand if an attempt to add files inside subdir to the
> repository controlled by worktree/.git is always correctly prohibited by
> the code, though, as our code often forgets to error out "stupid user
> mistakes", and running "git add subdir/bar" when in worktree/ falls into
> that category.
>

In my situation, WORKTREE/.git is tracking the worktree of WORKTREE/SUBDIR/.git. Before WORKTREE/SUBDIR/.git was created, WORKTREE/SUBDIR/ was already being tracked by WORKTREE/.git because WORKTREE/SUBDIR/. directly correlates to the rest of WORKTREE/., WORKTREE/SUBDIR2/., etc. Now that I know that having "a repo tracking the worktree of a nested repo" is not a sound model, I can advise against it on a go-forward basis without being concerned that I am not open to new ideas.

Show 5 quoted lines
> And the use of that layout predates the submodules by a large margin.
> In fact, when people suggest use of submodules when the toplevel and the
> sublevel do not even need tight version dependencies, some of their use
> cases might be better supported by using the simply-nested layout without
> even letting the toplevel be aware of the sublevel.
I will keep this in mind when adding submodules.
Thanks!

v/r, neal

Previous: Junio C Hamano
Message 5 of 5 in “nested git repos (not submodules)”
  1. Neal KreitzingerFeb 10, 2012
  2. Andrew ArdillFeb 10, 2012
  3. Neal KreitzingerFeb 10, 2012
  4. Junio C HamanoFeb 10, 2012
  5. Neal KreitzingerFeb 10, 2012

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.