On Sun, Oct 6, 2024 at 2:01 AM Caleb White <cdwhite3@xxxxx> wrote: > When re-initializing a repository with a separate gitdir (the original > gitdir is moved to a new location), any linked worktrees become broken > and must be repaired to reflect the new gitdir location. For absolute > paths, this breakage is one-way, but is both ways for relative paths > (the `<worktree>/.git` and the `<repo>/worktrees/<id>/gitdir`). > > Previously, `repair_worktrees` was being called which loops through all > the worktrees in the repository and updates the `<worktree>/.git` files > to point to the new gitdir. However, when both sides of the worktrees > are broken, the previous gitdir location is required to reestablish the > link. > > To fix this, the function `repair_worktrees_after_gitdir_move` is > introduced. It takes the old gitdir path as an argument and repairs both > sides of the worktree. > > This change fixes the following test cases in t0001-init.sh: > - re-init to move gitdir with linked worktrees > - re-init to move gitdir within linked worktree If I understand correctly, this patch is fixing breakage resulting from the preceding patch. Unfortunately, this approach is problematic since it breaks bisectability of the project. In particular, it's not sufficient for the full test suite to pass only at the end of the patch series; rather, the entire test suite should continue to pass after application of *each* patch in a series; we don't want one patch to break the test suite and a subsequent patch to fix it again. So, if my understanding is correct, please put some thought into how to reorganize this patch series to ensure that the full test suite passes for each patch.