Subject: [PATCH v3 0/1] [BUG] refs: verify does not work if there are v2.43.0 or older worktrees w/o wt. refs

From: shejialuo <[email-masked]>
Date: Mon, 2 Jun 2025 22:40:03 +0800

Hi All:

Changes in v2:

1. Update the commit message to incorporate the commit message that
introduces the BUG to better explain.
2. Update the shell script to avoid hardcode gitdir path.
3. Change "rm -rf" to be "rmdir", which would be safer because we should
delete an empty directory, which has a better semantics.

---

Changes in v3:

1. Use subshell for test style.

Thanks,
Jialuo

shejialuo (1):
  fsck: ignore missing "refs" directory for linked worktrees

 refs/files-backend.c     |  3 +++
 t/t0602-reffiles-fsck.sh | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

Range-diff against v2:
1:  d949a8a646 ! 1:  e4c32971da fsck: ignore missing "refs" directory for linked worktrees
    @@ t/t0602-reffiles-fsck.sh: test_expect_success 'ref name check should be adapted
     +		test_commit initial &&
     +		git worktree add --detach ./worktree &&
     +
    -+		cd worktree &&
    -+		worktree_refdir="$(git rev-parse --git-dir)/refs" &&
    -+		# Simulate old directory layout
    -+		rmdir "$worktree_refdir" &&
    -+		git refs verify 2>err &&
    -+		test_must_be_empty err
    ++		(
    ++			cd worktree &&
    ++			worktree_refdir="$(git rev-parse --git-dir)/refs" &&
    ++			# Simulate old directory layout
    ++			rmdir "$worktree_refdir" &&
    ++			git refs verify 2>err &&
    ++			test_must_be_empty err
    ++		)
     +	)
     +'
     +
-- 
2.49.0