mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'sj/ref-contents-check-fix'
"git verify-refs" (and hence "git fsck --reference") started erroring out in a repository in which secondary worktrees were prepared with Git 2.43 or lower. * sj/ref-contents-check-fix: fsck: ignore missing "refs" directory for linked worktrees
This commit is contained in:
@@ -3762,6 +3762,9 @@ static int files_fsck_refs_dir(struct ref_store *ref_store,
|
||||
|
||||
iter = dir_iterator_begin(sb.buf, 0);
|
||||
if (!iter) {
|
||||
if (errno == ENOENT && !is_main_worktree(wt))
|
||||
goto out;
|
||||
|
||||
ret = error_errno(_("cannot open directory %s"), sb.buf);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,25 @@ test_expect_success 'ref name check should be adapted into fsck messages' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'no refs directory of worktree should not cause problems' '
|
||||
test_when_finished "rm -rf repo" &&
|
||||
git init repo &&
|
||||
(
|
||||
cd repo &&
|
||||
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
|
||||
)
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'ref name check should work for multiple worktrees' '
|
||||
test_when_finished "rm -rf repo" &&
|
||||
git init repo &&
|
||||
|
||||
Reference in New Issue
Block a user