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

Re: [PATCH 2/6] t6014: test prune with detached HEADs in separate worktrees

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2016, 18:03 UTC
Message-ID
<xmqqwpprjqmc.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<47fd12af598614ca10fa28cb36fb98ca9ab6d7bb.1456504190.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> "git prune" relies on "git rev-list --all" to list all reachable,
> non-prunable commits. In the presence of per-worktree refs such as HEAD
> this becomes more complicated.

Not "all", perhaps "majority of". The index is another anchor point and rev-list is not involved in it at all.

For those that are anchored by refs and ref-like things, I think the right thing to do is not to change the semantics of "--all" like [3/6] does, but to invent a new option to "for-each-ref" that shows only the refs and ref-like things that are private to the worktree. That set may include HEAD and refs/bisect/*, perhaps.

With that, the scripted equivalent of "git repack", "git prune" and "git fsck" can ask "git worktree list" the list of worktrees to consult, and in each of them run "git for-each-ref --private" and "git ls-files -s" to grab the objects to be used as the starting point of reachability traversal.

Previous: Michael J GruberNext: Michael J Gruber
Message 5 of 11 in “Detached HEADs in new worktrees considered harmful”
  1. 0/6 Detached HEADs in new worktrees considered harmfulMichael J Gruber, Feb 26, 2016
  2. 1/6 Documentation/git-worktree: spell --detach correctlyMichael J Gruber, Feb 26, 2016
  3. Junio C HamanoFeb 26, 2016
  4. 2/6 t6014: test prune with detached HEADs in separate worktreesMichael J Gruber, Feb 26, 2016
  5. Junio C HamanoFeb 26, 2016
  6. 3/6 rev-list: list all heads with --allMichael J Gruber, Feb 26, 2016
  7. Duy NguyenFeb 27, 2016
  8. 4/6 WIP: mess only with mark_reachableMichael J Gruber, Feb 26, 2016
  9. 5/6 WIP: fix unborn branch caseMichael J Gruber, Feb 26, 2016
  10. 6/6 revisions: list all worktree HEADs with --allMichael J Gruber, Feb 26, 2016
  11. Junio C HamanoFeb 26, 2016

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.