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

Re: [PATCH] glossary: describe "worktree"

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 18, 2022, 20:50 UTC
Message-ID
<xmqq1qzzzyp1.fsf@gitster.g>
In-Reply-To
<220218.867d9rhqab.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> But I may be entirely missing the point here...

Not only FETCH_HEAD is a multi-line file, but each entry in it carry extra information that do not belong to a 'ref', like where it came from and whether its intended use is to merge into the current branch.

The file is much closer to what "rebase -i" uses its "todo list" for, than being a "ref-like" thing. The only similarity with a loose ref is that it begins with 40-hex and get_sha1_hex() will happily return success. The file format was designed to take advantage of the loose-ness of get_sha1_hex(), historically, so that the reading side can reuse the logic to read loose refs.

You can blame all of that to my laziness ;-).

After you fetch a single ref, get_oid("FETCH_HEAD") should keep returning the object name of what you fetched, but that does not mean the full multi-line trash needs to be stored in any ref backend. If you fetch multiple refs, get_oid("FETCH_HEAD") can only return one of them anyway, so as long as we keep the only useful use case working, we do not have to use the machinery the ref backend of choice uses to store it. It can remain an on-disk file, just like the "todo" list "rebase -i" uses is an on-disk file.

Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 13 of 14 in “glossary: describe "worktree"”
  1. glossary: describe "worktree"Junio C Hamano, Feb 10, 2022
  2. Derrick StoleeFeb 10, 2022
  3. Elijah NewrenFeb 10, 2022
  4. Junio C HamanoFeb 10, 2022
  5. Elijah NewrenFeb 10, 2022
  6. Han-Wen NienhuysFeb 10, 2022
  7. Junio C HamanoFeb 10, 2022
  8. Han-Wen NienhuysFeb 10, 2022
  9. Junio C HamanoFeb 10, 2022
  10. Han-Wen NienhuysFeb 17, 2022
  11. Junio C HamanoFeb 17, 2022
  12. Ævar Arnfjörð BjarmasonFeb 18, 2022
  13. Junio C HamanoFeb 18, 2022
  14. Junio C HamanoFeb 10, 2022

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.