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

Re: [PATCH v4 00/16] Fix git-gc losing objects in multi worktree

From
Michael J Gruber <git@grubix.eu>
Date
Aug 25, 2017, 11:21 UTC
Message-ID
<6b67875c-847c-8d5f-14bb-c3fb7004ebdc@grubix.eu>
In-Reply-To
<20170823123704.16518-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy venit, vidit, dixit 23.08.2017 14:36:
Show 30 quoted lines
> "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@gmail.com/
> 
> 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
Previous: Michael HaggertyNext: Duy Nguyen
Message 38 of 40 in “Fix git-gc losing objects in multi worktree”
  1. 00/16 Fix git-gc losing objects in multi worktreeNguyễn Thái Ngọc Duy, Aug 23, 2017
  2. 01/16 revision.h: new flag in struct rev_info wrt. worktree-related refsNguyễn Thái Ngọc Duy, Aug 23, 2017
  3. 02/16 refs.c: use is_dir_sep() in resolve_gitlink_ref()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  4. Stefan BellerAug 23, 2017
  5. Duy NguyenSep 6, 2017
  6. Stefan BellerSep 6, 2017
  7. 03/16 revision.c: refactor add_index_objects_to_pending()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  8. 04/16 revision.c: --indexed-objects add objects from all worktreesNguyễn Thái Ngọc Duy, Aug 23, 2017
  9. Stefan BellerAug 23, 2017
  10. 05/16 refs.c: refactor get_submodule_ref_store(), share common free blockNguyễn Thái Ngọc Duy, Aug 23, 2017
  11. Stefan BellerAug 23, 2017
  12. 06/16 refs: move submodule slash stripping code to get_submodule_ref_storeNguyễn Thái Ngọc Duy, Aug 23, 2017
  13. Michael HaggertySep 9, 2017
  14. 07/16 refs: add refs_head_ref()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  15. Junio C HamanoAug 24, 2017
  16. Duy NguyenSep 6, 2017
  17. 08/16 revision.c: use refs_for_each*() instead of for_each_*_submodule()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  18. Junio C HamanoAug 24, 2017
  19. 09/16 refs.c: move for_each_remote_ref_submodule() to submodule.cNguyễn Thái Ngọc Duy, Aug 23, 2017
  20. 10/16 refs: remove dead for_each_*_submodule()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  21. Stefan BellerAug 23, 2017
  22. Michael HaggertySep 9, 2017
  23. 11/16 revision.c: --all adds HEAD from all worktreesNguyễn Thái Ngọc Duy, Aug 23, 2017
  24. Stefan BellerAug 23, 2017
  25. Duy NguyenSep 6, 2017
  26. Stefan BellerSep 6, 2017
  27. Michael HaggertySep 9, 2017
  28. 12/16 files-backend: make reflog iterator go through per-worktree reflogNguyễn Thái Ngọc Duy, Aug 23, 2017
  29. Richard MawAug 24, 2017
  30. Michael HaggertySep 9, 2017
  31. 13/16 revision.c: --reflog add HEAD reflog from all worktreesNguyễn Thái Ngọc Duy, Aug 23, 2017
  32. 14/16 rev-list: expose and document --single-worktreeNguyễn Thái Ngọc Duy, Aug 23, 2017
  33. Stefan BellerAug 23, 2017
  34. 15/16 refs.c: remove fallback-to-main-store code get_submodule_ref_store()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  35. Michael HaggertySep 9, 2017
  36. 16/16 refs.c: reindent get_submodule_ref_store()Nguyễn Thái Ngọc Duy, Aug 23, 2017
  37. Michael HaggertySep 9, 2017
  38. Michael J GruberAug 25, 2017
  39. Duy NguyenSep 6, 2017
  40. Michael HaggertySep 9, 2017

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.