Re: [PATCH v4 00/16] Fix git-gc losing objects in multi worktree
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Sep 6, 2017, 10:53 UTC
- Message-ID
- <CACsJy8Cd20iPo4uv5+sq0SiuPT3Y6sxEtJqDsox+3tVRsgg9UA@mail.gmail.com>
- In-Reply-To
- <6b67875c-847c-8d5f-14bb-c3fb7004ebdc@grubix.eu>
On Fri, Aug 25, 2017 at 6:21 PM, Michael J Gruber <git@grubix.eu> wrote:
Show 9 quoted lines
> I suggest we think about the UI exposure a bit when it > comes to including all heads or naming options, though: > > * HEAD is "the current head" > * refs/heads is where all local branch heads are > > * --branches is the rev-list/log option for refs/heads/* > * --all is the rev-list/log option for refs/* plus HEAD > * HEAD is the rev-list/log argument for HEAD
It also covers object references from the index file aka --indexed-objects
Show 13 quoted lines
> * --heads is the show-ref option limiting to refs/heads/* > * --head is the show-ref option which adds HEAD > > * refs/heads is the for-each-ref-pattern for refs/heads/* > * HEAD is not the for-each-ref-pattern for HEAD > [I'll suggest a patch to change the latter, shortly.] > > I would hope that the result of this series and other efforts will be: > > * consistent way to specify "all local branch heads" > * consistent way to specify "the head" aka HEAD > * consistent way to specify "all linked worktree heads" > [* maybe something for submodules...]
Hmm.. I admit that I completely overlooked 'git show-ref'.
Show 15 quoted lines
> This may require changing the misnamed show-ref option, but also > thinking twice before changing the meaning of "--all" for the > rev-list/log family: it's easy to say "--all --linked" or "--all > --heads" to get everything plus all linked worktree heads when "--all" > == "--branches --tags HEAD", but it's more cumbersome with a changed > --all that is "really everything". I gues my suggestion would be: > > --all as it is now (refs/* plus HEAD) > > --head alternative way to say HEAD (as it is now for show-ref) > > --heads HEAD for all linked worktrees (incompatible change for show-ref) > > And all of them should work the same for the rev-list/log family as well > as for-each-ref/show-ref.
How about: show-ref learns a new option to let it list HEAD (and other per-worktree refs) of one/current worktree, or all worktrees. This is what the --single-worktree option is for, which is added by this series (but I need to make sure if's exposed in show-ref as well). For showing refs as viewed by another worktree, we could have the global option similar to --git-dir to select that worktree, e.g. "git --work-tree-id=XXX show-ref ..."?
Since this seems a good thing to do, but not necessary to fix the "prune" bug, I'll do it separately instead of adding in this series. I may need to look at "git for-each-ref" too for that matter.
> I thinking that changing show-ref (porcelain, not quite as commonly > used) should do the least harm compared to all other options.
-- Duy