From: Yoichi NAKAYAMA via GitGitGadget Date: Sun, 13 Sep 2026 03:20:11 GMT Subject: [PATCH 0/2] worktree repair: avoid breaking unrelated .git file and gitdir Message-ID: 'git worktree repair' does not sufficiently validate the cross-references between a linked working tree and its administrative data before repairing them. This can cause the repair to modify the wrong .git file or gitdir in certain situations. This series first refactors the code to read the .git file once and extract the worktree ID, then uses that information to validate the repair target before modifying the cross-references. * [1/2] Refactor the code without changing functionality before making the fix * [2/2] Validate the worktree ID and inferred gitdir path before repairing Yoichi NAKAYAMA (2): worktree repair: refactor and reduce .git file reads worktree repair: avoid breaking unrelated .git file and gitdir t/t2406-worktree-repair.sh | 33 +++++++++--- worktree.c | 105 ++++++++++++++++++++----------------- 2 files changed, 83 insertions(+), 55 deletions(-) base-commit: 47ce80527c56f462cb97db4ca8125342204d3783 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2225%2Fyoichi%2Fworktree-repair-keep-unrelated-gitfile-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2225/yoichi/worktree-repair-keep-unrelated-gitfile-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/2225 -- gitgitgadget