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

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Sat, 22 Sep 2018 20:04:52 +0200

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