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

[PATCH 0/8] fix per-worktree ref iteration in fsck/reflog expire

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 22, 2018, 18:04 UTC
Message-ID
<20180922180500.4689-1-pclouds@gmail.com>

Sorry it took me so long to revisit these bugs, even though the first one was reported nearly a year ago. I guess I slept on it way longer than I should have.

This series opens up the currrent worktree's ref space, allowing one worktree to see refs from other worktrees. With this, it's possible to have less confusing error reports (e.g. "heh.. what HEAD are you talking about?"). And it's possible to peek one worktree from another, e.g. now I could do

    git checkout main/HEAD
    make test -j8

in one terminal and go back to the original terminal and continue hacking while tests are being run in the background.

With this issue out of the way, I could now continue to fix the "forget to look at all HEADs/reflogs" problem in fsck and "reflog expire". The fsck patches are mostly from Elijah with some code/test adaptation from me.

I also take this opportunity to try to standardize a common/private space in $GIT_DIR or ref hierarchy so we don't have to add more rules in the future.

One heads up. One remaining problem with "refs and worktrees" is the ability to completely separate ref space between worktrees (i.e. refs/heads/master on worktree A is completely different than one in worktree B). This is needed to make use worktrees in submodules. But the way I see it, per-worktree refs may have to be moved back to $GIT_COMMON_DIR/refs to be efficient.

This may be backward incompatible change. Haven't thought it through yet (and didn't see it coming because I largely ignored refs/bisect, which should have made me think about this much earlier)

Elijah Newren (2):
  fsck: Move fsck_head_link() to get_default_heads() to avoid some globals
  fsck: check HEAD and reflog from other worktrees
Nguyễn Thái Ngọc Duy (6):
  refs.c: indent with tabs, not spaces
  Add a place for (not) sharing stuff between worktrees
  refs: new ref types to make per-worktree refs visible to all worktrees
  revision.c: correct a parameter name
  revision.c: better error reporting on ref from different worktrees
  reflog expire: cover reflog from all worktrees
 Documentation/git-reflog.txt           |  7 ++-
 Documentation/gitrepository-layout.txt | 11 ++++-
 builtin/fsck.c                         | 68 ++++++++++++++++++--------
 builtin/reflog.c                       | 22 +++++++--
 path.c                                 |  1 +
 refs.c                                 | 23 ++++++++-
 refs.h                                 |  8 +--
 refs/files-backend.c                   | 42 ++++++++++++++--
 revision.c                             | 22 ++++++---
 t/t0060-path-utils.sh                  |  2 +
 t/t1415-worktree-refs.sh               | 66 +++++++++++++++++++++++++
 t/t1450-fsck.sh                        | 39 +++++++++++++++
 worktree.c                             | 32 ++++++++++--
 worktree.h                             | 14 ++++++
 14 files changed, 312 insertions(+), 45 deletions(-)
 create mode 100755 t/t1415-worktree-refs.sh
-- 
2.19.0.647.gb9a6049235
Next: Nguyễn Thái Ngọc Duy
Message 1 of 60 in “fix per-worktree ref iteration in fsck/reflog expire”
  1. 0/8 fix per-worktree ref iteration in fsck/reflog expireNguyễn Thái Ngọc Duy, Sep 22, 2018
  2. 1/8 refs.c: indent with tabs, not spacesNguyễn Thái Ngọc Duy, Sep 22, 2018
  3. 2/8 Add a place for (not) sharing stuff between worktreesNguyễn Thái Ngọc Duy, Sep 22, 2018
  4. Eric SunshineSep 23, 2018
  5. Stefan BellerSep 25, 2018
  6. Duy NguyenSep 25, 2018
  7. Stefan BellerSep 25, 2018
  8. Duy NguyenSep 25, 2018
  9. Stefan BellerSep 25, 2018
  10. 3/8 refs: new ref types to make per-worktree refs visible to all worktreesNguyễn Thái Ngọc Duy, Sep 22, 2018
  11. Eric SunshineSep 23, 2018
  12. Duy NguyenSep 23, 2018
  13. Stefan BellerSep 25, 2018
  14. Duy NguyenSep 25, 2018
  15. Stefan BellerSep 25, 2018
  16. Junio C HamanoSep 25, 2018
  17. Duy NguyenSep 29, 2018
  18. Junio C HamanoOct 6, 2018
  19. 4/8 revision.c: correct a parameter nameNguyễn Thái Ngọc Duy, Sep 22, 2018
  20. 5/8 revision.c: better error reporting on ref from different worktreesNguyễn Thái Ngọc Duy, Sep 22, 2018
  21. Eric SunshineSep 23, 2018
  22. Duy NguyenSep 23, 2018
  23. 7/8 fsck: check HEAD and reflog from other worktreesNguyễn Thái Ngọc Duy, Sep 22, 2018
  24. Eric SunshineSep 23, 2018
  25. Duy NguyenSep 29, 2018
  26. 8/8 reflog expire: cover reflog from all worktreesNguyễn Thái Ngọc Duy, Sep 22, 2018
  27. 6/8 fsck: Move fsck_head_link() to get_default_heads() to avoid some globalsNguyễn Thái Ngọc Duy, Sep 22, 2018
  28. 0/8 fix per-worktree ref iteration in fsck/reflog expireNguyễn Thái Ngọc Duy, Sep 29, 2018
  29. 2/8 Add a place for (not) sharing stuff between worktreesNguyễn Thái Ngọc Duy, Sep 29, 2018
  30. 1/8 refs.c: indent with tabs, not spacesNguyễn Thái Ngọc Duy, Sep 29, 2018
  31. 3/8 refs: new ref types to make per-worktree refs visible to all worktreesNguyễn Thái Ngọc Duy, Sep 29, 2018
  32. Eric SunshineSep 30, 2018
  33. Junio C HamanoOct 7, 2018
  34. 4/8 revision.c: correct a parameter nameNguyễn Thái Ngọc Duy, Sep 29, 2018
  35. 5/8 revision.c: better error reporting on ref from different worktreesNguyễn Thái Ngọc Duy, Sep 29, 2018
  36. Eric SunshineSep 30, 2018
  37. 7/8 fsck: check HEAD and reflog from other worktreesNguyễn Thái Ngọc Duy, Sep 29, 2018
  38. 6/8 fsck: Move fsck_head_link() to get_default_heads() to avoid some globalsNguyễn Thái Ngọc Duy, Sep 29, 2018
  39. 8/8 reflog expire: cover reflog from all worktreesNguyễn Thái Ngọc Duy, Sep 29, 2018
  40. Eric SunshineSep 30, 2018
  41. Duy NguyenOct 2, 2018
  42. Eric SunshineOct 3, 2018
  43. 0/8 fix per-worktree ref iteration in fsck/reflog expireNguyễn Thái Ngọc Duy, Oct 21, 2018
  44. 1/8 refs.c: indent with tabs, not spacesNguyễn Thái Ngọc Duy, Oct 21, 2018
  45. 2/8 Add a place for (not) sharing stuff between worktreesNguyễn Thái Ngọc Duy, Oct 21, 2018
  46. Junio C HamanoOct 22, 2018
  47. Duy NguyenOct 29, 2018
  48. SZEDER GáborOct 22, 2018
  49. 3/8 refs: new ref types to make per-worktree refs visible to all worktreesNguyễn Thái Ngọc Duy, Oct 21, 2018
  50. Ævar Arnfjörð BjarmasonNov 24, 2018
  51. Junio C HamanoNov 25, 2018
  52. files-backend.c: fix build error on SolarisNguyễn Thái Ngọc Duy, Nov 25, 2018
  53. Carlo ArenasNov 25, 2018
  54. Duy NguyenNov 25, 2018
  55. Junio C HamanoNov 26, 2018
  56. 4/8 revision.c: correct a parameter nameNguyễn Thái Ngọc Duy, Oct 21, 2018
  57. 5/8 revision.c: better error reporting on ref from different worktreesNguyễn Thái Ngọc Duy, Oct 21, 2018
  58. 6/8 fsck: Move fsck_head_link() to get_default_heads() to avoid some globalsNguyễn Thái Ngọc Duy, Oct 21, 2018
  59. 7/8 fsck: check HEAD and reflog from other worktreesNguyễn Thái Ngọc Duy, Oct 21, 2018
  60. 8/8 reflog expire: cover reflog from all worktreesNguyễn Thái Ngọc Duy, Oct 21, 2018

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.