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

Re: [BUG] worktree local refs weirdness

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 7, 2019, 09:46 UTC
Message-ID
<CACsJy8CrSGQt=_RK8cwc3AW_+gfGLf_M5UKAmjMZrm43Qu3Z8Q@mail.gmail.com>
In-Reply-To
<ec707cbb-96e8-f26f-3d69-b69d29b31737@gmail.com>
On Thu, Mar 7, 2019 at 4:38 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 14 quoted lines
>
> On 06/03/2019 15:57, Phillip Wood wrote:
> > When it is run in a worktree 'git for-each-ref' only seems to show refs
> > under refs/rewritten if that directory also exists under $GIT_COMMON_DIR
> > even though they are local to the worktree.
> >
> > Initially I thought this was due to $GIT_COMMON_DIR pointing to a bare
> > repo, but that is not the case. However while writing a test case which
> > cloned to a bare repo I noticed it was listing a ref for the HEAD of a
> > worktree in the repo I had cloned from, not the clone itself.
>
> Ignore that last paragraph, it's just showing the branch that got
> created when the worktree was created. The last part of the script is
> redundant, I've updated it below

Thanks for the test script. I could reproduce it and I think I see the problem (update-ref creates per-worktree refs even though refs/rewritten should be per-repo). Working on it...

-- 
Duy
Previous: Phillip WoodNext: Duy Nguyen
Message 3 of 11 in “[BUG] worktree local refs weirdness”
  1. Phillip WoodMar 6, 2019
  2. Phillip WoodMar 7, 2019
  3. Duy NguyenMar 7, 2019
  4. Duy NguyenMar 7, 2019
  5. 0/3 Fix refs/rewritten not show up in for-each-refNguyễn Thái Ngọc Duy, Mar 7, 2019
  6. 1/3 files-backend.c: factor out per-worktree code in loose_fill_ref_dir()Nguyễn Thái Ngọc Duy, Mar 7, 2019
  7. 2/3 files-backend.c: reduce duplication in add_per_worktree_entries_to_dir()Nguyễn Thái Ngọc Duy, Mar 7, 2019
  8. Phillip WoodMar 7, 2019
  9. 3/3 Make sure refs/rewritten/ is per-worktreeNguyễn Thái Ngọc Duy, Mar 7, 2019
  10. Phillip WoodMar 7, 2019
  11. Duy NguyenMar 7, 2019

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.