Nguyễn Thái Ngọc Duy venit, vidit, dixit 23.08.2017 14:36: > "git gc" when used in multiple worktrees ignore some per-worktree > references: object references in the index, HEAD and reflog. This > series fixes it by making the revision walker include these from all > worktrees by default (and the series is basically split in three parts > in the same order). There's a couple more cleanups in refs.c. Luckily > it does not conflict with anything in 'pu'. > > Compared to v3 [1], the largest change is supporting multi worktree in > the reflog iterator. The merge iterator is now used (Micheal was right > all along). > > [1] https://public-inbox.org/git/20170419110145.5086-1-pclouds@xxxxxxxxx/ > > Nguyễn Thái Ngọc Duy (16): > revision.h: new flag in struct rev_info wrt. worktree-related refs > refs.c: use is_dir_sep() in resolve_gitlink_ref() > revision.c: refactor add_index_objects_to_pending() > revision.c: --indexed-objects add objects from all worktrees > refs.c: refactor get_submodule_ref_store(), share common free block > refs: move submodule slash stripping code to get_submodule_ref_store > refs: add refs_head_ref() > revision.c: use refs_for_each*() instead of for_each_*_submodule() > refs.c: move for_each_remote_ref_submodule() to submodule.c > refs: remove dead for_each_*_submodule() > revision.c: --all adds HEAD from all worktrees > files-backend: make reflog iterator go through per-worktree reflog > revision.c: --reflog add HEAD reflog from all worktrees > rev-list: expose and document --single-worktree > refs.c: remove fallback-to-main-store code get_submodule_ref_store() > refs.c: reindent get_submodule_ref_store() I probably won't be able to review this (many commits without commit message), but I'm happy to see progress on the "--all" and prune front (and will test). 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 * --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...] 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. I thinking that changing show-ref (porcelain, not quite as commonly used) should do the least harm compared to all other options. Michael