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

Re: [RFC PATCH 3/3] fsck: Check HEAD of other worktrees as well

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 10, 2018, 20:11 UTC
Message-ID
<xmqqmv0gtxjs.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180210095952.GA9035@ash>
Duy Nguyen <pclouds@gmail.com> writes:
Show 17 quoted lines
> On Fri, Feb 09, 2018 at 03:13:30PM -0800, Elijah Newren wrote:
>> This takes advantage of the fact that "worktrees/$WORKTREE/HEAD" will
>> currently resolve as a ref, which may not be true in the future with
>> different ref backends.  I don't think it locks us in to supporting
>> resolving other worktree HEADs with this syntax, as I view the
>> user-visible error message as more of a pointer to a pathname that the
>> user will need to fix.  If the underlying ref storage changes, naturally
>> both this code and the hint may need to change to match.
>
> I'm leaning more about something like this patch below (which does not
> even build, just to demonstrate). A couple points:
>
> - Instead of doing the hacky refs worktrees/foo/HEAD, we get the
>   correct ref store for each worktree
> - We have an API for getting all (non-broken) worktrees. I realize for
>   fsck, we may even want to examine semi-broken worktrees as well, but
>   get_worktrees() can take a flag to accomplish that if needed.
Very sensible.  

When I saw that "fsck" thing, the first thing I wondered was "wait, how are we doing prune and repack while making sure objects reachable only from HEAD in other worktrees are not lost? we must already have an API that gives us where the refs of them are stored in".

Thanks for a quick response for course correction.
Previous: Jeff KingNext: Elijah Newren
Message 5 of 7 in “Make fsck check other worktree HEADs”
  1. 0/3 Make fsck check other worktree HEADsElijah Newren, Feb 9, 2018
  2. 3/3 fsck: Check HEAD of other worktrees as wellElijah Newren, Feb 9, 2018
  3. Duy NguyenFeb 10, 2018
  4. Jeff KingFeb 10, 2018
  5. Junio C HamanoFeb 10, 2018
  6. 1/3 fsck: Move fsck_head_link() to get_default_heads() to avoid some globalsElijah Newren, Feb 9, 2018
  7. 2/3 t1450-fsck: Add tests for HEAD of other worktreesElijah Newren, Feb 9, 2018

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.