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

Re: [PATCH v3 1/2] rebase: skip branch symref aliases

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jul 29, 2026, 09:31 UTC
Message-ID
<61291144-60da-4e37-83ef-fe09e91c4f51@gmail.com>
In-Reply-To
<xmqqpl07fb1u.fsf@gitster.g>
On 28/07/2026 15:23, Junio C Hamano wrote:
Show 12 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>>> But stepping back a bit, is having a HEAD that is a symref and
>>> points outside "refs/heads/" an invalid state?  Why are we catering
>>> to such a configuration to begin with?
>>
>> We allow HEAD to point to anything below "refs/" - see e9cc02f0e4
>> (symbolic-ref: allow refs/<whatever> in HEAD, 2009-02-13).
> 
> But that was about a low level mechanism that must be more lenient
> to be usable as repair tools to recover from such a broken state,
> no?

It checks the new value of HEAD, not the old one so I don't think so. The commit message talks about topgit using "git symbolic-ref" to set head outside "refs/heads/" - peff had previously tried to tighten it to reject non-branch refs but that broke topgit. I've just had a quick look at the topgit code and still sets HEAD to point to "refs/top-bases/..." by default[1], although there are plans to start using "refs/heads/{top-bases}/..." instead.

>  I thought the end-user facing commands like "git checkout" have
> been tightened long ago to stop users from getting into a situation
> that needs repairing in the first place.  And that was why I asked.

Yes "git checkout" detaches HEAD if you give a non-branch ref, but external tools can still use "git symbolic-ref" to bypass that. It appears topgit's rebase command is built around "git rebase"[2] so I think we need to continue to support rebasing a non-branch HEAD.

Thanks
Phillip

[1] https://github.com/mackyle/topgit/blob/master/tg.sh#L2683 [2] https://github.com/mackyle/topgit/blob/master/tg-rebase.sh#L56

Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 25 in “rebase: handle --update-refs branch symrefs”
  1. 0/2 rebase: handle --update-refs branch symrefsSon Luong Ngoc via GitGitGadget, May 28, 2026
  2. 1/2 t3404: add failing branch symref testSon Luong Ngoc via GitGitGadget, May 28, 2026
  3. Phillip WoodJun 1, 2026
  4. 2/2 rebase: skip branch symref aliasesSon Luong Ngoc via GitGitGadget, May 28, 2026
  5. Kristoffer HaugsbakkMay 28, 2026
  6. Phillip WoodJun 1, 2026
  7. Junio C HamanoMay 28, 2026
  8. rebase: skip branch symref aliasesSon Luong Ngoc via GitGitGadget, Jun 3, 2026
  9. Phillip WoodJun 4, 2026
  10. Son Luong NgocJul 22, 2026
  11. 0/2 rebase: handle --update-refs branch symrefsSon Luong Ngoc via GitGitGadget, Jul 22, 2026
  12. 1/2 rebase: skip branch symref aliasesSon Luong Ngoc via GitGitGadget, Jul 22, 2026
  13. Phillip WoodJul 23, 2026
  14. Phillip WoodJul 24, 2026
  15. Erik Cervin-EdinJul 25, 2026
  16. Junio C HamanoJul 26, 2026
  17. Phillip WoodJul 28, 2026
  18. Junio C HamanoJul 28, 2026
  19. Phillip WoodJul 29, 2026
  20. Junio C HamanoJul 29, 2026
  21. Phillip WoodJul 30, 2026
  22. Junio C HamanoAug 6, 2026
  23. Phillip WoodAug 7, 2026
  24. 2/2 rebase: guard non-branch symref targetsSon Luong Ngoc via GitGitGadget, Jul 22, 2026
  25. Phillip WoodAug 7, 2026

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.