"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() Documentation/rev-list-options.txt | 8 ++ Documentation/technical/api-ref-iteration.txt | 7 +- reachable.c | 2 + refs.c | 110 ++++++--------------- refs.h | 20 +--- refs/files-backend.c | 59 +++++++++--- revision.c | 131 +++++++++++++++++++++----- revision.h | 1 + submodule.c | 9 ++ t/t1407-worktree-ref-store.sh | 30 ++++++ t/t5304-prune.sh | 37 ++++++++ worktree.c | 22 +++++ worktree.h | 8 ++ 13 files changed, 308 insertions(+), 136 deletions(-) -- 2.11.0.157.gd943d85