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

Re: [PATCH 0/5] make room for "special ref"

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Dec 15, 2023, 22:44 UTC
Message-ID
<321b8084-fddb-4b5d-86af-7f88cb3edf7b@ramsayjones.plus.com>
In-Reply-To
<xmqq5y0zkvqx.fsf@gitster.g>
On 15/12/2023 21:21, Junio C Hamano wrote:
Show 48 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> ...  For example, FETCH_HEAD currently stores not
>> just a single object name, but can and is used to store multiple
>> object names, each with annotations to record where they came from.
>> There indeed may be a need to introduce a new term to refer to such
>> "special refs".
> 
> The "may be" here vaguely hints another possibility.  If we manage
> to get rid of the "special refs", we do not even have to mention
> "special refs", and more importantly, we do not need extra code to
> deal with them.
> 
> For FETCH_HEAD, for example, I wonder if an update along this line
> is possible:
> 
>  * Teach "git fetch" to store what it writes to FETCH_HEAD to a
>    different file, under a distinctly different filename (e.g.,
>    $GIT_DIR/fetched-tips).  Demote FETCH_HEAD to a pseudoref, and
>    store the first object name in that "fetched-tips" file to it.
> 
>  * Teach "git pull" to learn what it used to learn from FETCH_HEAD
>    (i.e., list of fetched tips, each annotated with what ref at what
>    repository it came from and if it is to be merged) from the new
>    "fetched-tips" file.
> 
> The "special" ness of FETCH_HEAD is really an implementation detail
> of how "git pull" works and how the findings of "git fetch" are
> communicated to "git pull".  The general refs API should not have to
> worry about it, and the refs backends should not have to worry about
> storing more than just an object name (or if it is a symbolic ref,
> the target refname).
> 
> An end-user command like "git log ORIG_HEAD..FETCH_HEAD" would not
> be affected by changes along the above line, because the current
> FETCH_HEAD, when used as a revision, will work as if it stores the
> single object name that is listed first in the file.
> 
> If somebody is reading FETCH_HEAD and acting on its contents (rather
> than merely consuming it as a ref of the first object), perhaps
> feeding it to "git fmt-merge-msg", they will be broken by such a
> change (indeed, our own "git pull" will be broken by the change to
> "git fetch", and the second bullet point above is about fixing the
> exact fallout from it), but I am not sure if that is a use case worth
> worrying about.
> 
> Hmm?
> 

Yes, I was going to suggest exactly this, after Patrick pointed out that there were only two 'special psuedo-refs' (I had a vague feeling there were some more than that) FETCH_HEAD and MERGE_HEAD.

ATB, Ramsay Jones

Previous: Junio C HamanoNext: Junio C Hamano
Message 20 of 26 in “make room for "special ref"”
  1. 0/5 make room for "special ref"Junio C Hamano, Dec 15, 2023
  2. 2/5 git-bisect.txt: BISECT_HEAD is not that specialJunio C Hamano, Dec 15, 2023
  3. 1/5 git.txt: HEAD is not that specialJunio C Hamano, Dec 15, 2023
  4. Ramsay JonesDec 15, 2023
  5. Junio C HamanoDec 15, 2023
  6. Junio C HamanoDec 15, 2023
  7. doc: format.notes specify a ref under refs/notes/ hierarchyJunio C Hamano, Dec 15, 2023
  8. Patrick SteinhardtDec 18, 2023
  9. Junio C HamanoDec 18, 2023
  10. Jiang XinDec 19, 2023
  11. Ramsay JonesDec 15, 2023
  12. Patrick SteinhardtDec 18, 2023
  13. Junio C HamanoDec 18, 2023
  14. 3/5 refs.h: HEAD is not that specialJunio C Hamano, Dec 15, 2023
  15. Andy KoppeDec 16, 2023
  16. 4/5 docs: AUTO_MERGE is not that specialJunio C Hamano, Dec 15, 2023
  17. 5/5 docs: MERGE_AUTOSTASH is not that specialJunio C Hamano, Dec 15, 2023
  18. Andy KoppeDec 16, 2023
  19. Junio C HamanoDec 15, 2023
  20. Ramsay JonesDec 15, 2023
  21. Junio C HamanoDec 16, 2023
  22. Patrick SteinhardtDec 18, 2023
  23. Andy KoppeDec 16, 2023
  24. Patrick SteinhardtDec 18, 2023
  25. Andy KoppeDec 16, 2023
  26. Patrick SteinhardtDec 18, 2023

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.