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

Re: The design of refs backends, linked worktrees and submodules

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 7, 2017, 15:07 UTC
Message-ID
<CACsJy8CYrbSJqbG7h+-wQPNBCNAVs94Hx7m8qXXb88L0o-rw0Q@mail.gmail.com>
In-Reply-To
<CACsJy8CHoroX2k9GqOFmXkvvPCPN4SBeCg+6aC2WSWNSKVmWQw@mail.gmail.com>
On Thu, Jan 19, 2017 at 6:55 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 6 quoted lines
> I've started working on fixing the "git gc" issue with multiple
> worktrees, which brings me back to this. Just some thoughts. Comments
> are really appreciated.
>
> In the current code, files backend has special cases for both
> submodules (explicitly) and linked worktrees (hidden behind git_path).

It just occurs to me that, since the refs directory structure of a linked worktree is exactly like one in a normal single-worktree setup, minus the shared (or packed) refs. The "files" refs backend can just see this "per-worktree only" refs directory as a remote refs storage, which is just another name for "submodule".

So, we could just use the exact same submodule code path in refs to create a per-worktree refs storage. Doing it this way, files backedn do not need to learn about linked worktrees at all. To retrieve a per-worktree refs storage, we do "get_ref_store(".git/worktrees/foobar")". To get all per-worktree refs do for_each_ref_submodule(".git/worktrees/foobar", ...).

Does it make sense? Should we go this way?
-- 
Duy
Previous: Junio C Hamano
Message 6 of 6 in “The design of refs backends, linked worktrees and submodules”
  1. Duy NguyenJan 19, 2017
  2. Michael HaggertyJan 19, 2017
  3. Johannes SchindelinJan 19, 2017
  4. Duy NguyenJan 20, 2017
  5. Junio C HamanoJan 19, 2017
  6. Duy NguyenFeb 7, 2017

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.