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

Re: [PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD

From
Runxi Yu <me@runxiyu.org>
Date
Feb 24, 2026, 04:33 UTC
Message-ID
<DGMWTSG72GEI.1TA0INKB1UHB6@runxiyu.org>
In-Reply-To
<xmqq1pibnuej.fsf@gitster.g>
On Tue Feb 24, 2026 at 3:15 AM CST, Junio C Hamano wrote:
> Did it ever worked before?  When did it regress?

Not that I know of. Unfortunately it's a bit difficult to build older versions, but the same logic was present in this commit and in main:

Show 13 quoted lines
> commit 9fdf4f1db422cc259e4a3ce0023a255102c6fa3b
> Author: Anders Kaseorg <andersk@MIT.EDU>
> Date:   Wed Dec 1 14:15:46 2021 -0800
> 
>     receive-pack: protect current branch for bare repository worktree
>     
>     A bare repository won’t have a working tree at "..", but it may still
>     have separate working trees created with git worktree. We should protect
>     the current branch of such working trees from being updated or deleted,
>     according to receive.denyCurrentBranch.
>     
>     Signed-off-by: Anders Kaseorg <andersk@mit.edu>
>     Signed-off-by: Junio C Hamano <gitster@pobox.com>

update finds the destination linked worktree correctly update_worktree sets GIT_DIR push_to_deploy decides whether to diff against HEAD or the empty tree by calling head_has_history but head_has_history uses the bare repo's HEAD rather than the destination worktree

head_has_history used get_oid before vs repo_get_oid now, but they still both seem to use the bare repo instead of the worktree's HEAD.

So if the bare repo's own HEAD is unborn, in both current main and 9fdf4f1db42, we would be incorrectly choosing the empty tree for the 'has staged changes' check's base, and report failure, even though the linked worktree is clean

Well, by regression test, I don't mean that this was a previous regression; I just mean that, this was a way to reproduce this bug that sounds reasonable and could serve as a future regression test.

Previous: Junio C HamanoNext: Runxi Yu
Message 3 of 11 in “t5516: test updateInstead with worktree and unborn bare HEAD”
  1. t5516: test updateInstead with worktree and unborn bare HEADRunxi Yu, Feb 23, 2026
  2. Junio C HamanoFeb 23, 2026
  3. Runxi YuFeb 24, 2026
  4. Runxi YuMar 3, 2026
  5. 0/3 receive-pack: fix HEAD check for updateInsteadPablo Sabater, Mar 30, 2026
  6. 1/3 t5516: test updateInstead with worktree and unborn bare HEADPablo Sabater, Mar 30, 2026
  7. 2/3 t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees testPablo Sabater, Mar 30, 2026
  8. 3/3 receive-pack: use worktree HEAD for updateInsteadPablo Sabater, Mar 30, 2026
  9. Junio C HamanoMar 30, 2026
  10. PabloMar 30, 2026
  11. Junio C HamanoMar 31, 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.