git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] worktree repair: avoid breaking unrelated .git file and gitdir

From
Yoichi NAKAYAMA via GitGitGadget <gitgitgadget@gmail.com>
Date
Sep 13, 2026, 03:20 UTC
Message-ID
<pull.2225.git.1789269613.gitgitgadget@gmail.com>

'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
Next: Yoichi NAKAYAMA via GitGitGadget
Message 1 of 4 in “worktree repair: avoid breaking unrelated .git file and gitdir”
  1. 0/2 worktree repair: avoid breaking unrelated .git file and gitdirYoichi NAKAYAMA via GitGitGadget, Sep 13, 2026
  2. 1/2 worktree repair: refactor and reduce .git file readsYoichi NAKAYAMA via GitGitGadget, Sep 13, 2026
  3. 2/2 worktree repair: avoid breaking unrelated .git file and gitdirYoichi NAKAYAMA via GitGitGadget, Sep 13, 2026
  4. Yoichi NAKAYAMAOct 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.