The purpose of this patch series is twofold. First, it adds a "git worktree repair" command to help users recover from situations in which worktree administrative files can become outdated or corrupted due to external factors. Simple examples include (1) the user moving a worktree manually rather than via "git worktree move" which causes the main worktree (or bare repository) to lose track of the worktree, and (2) moving the main worktree (or bare repository) which results in linked worktrees being unable to find the repository. Second, it fixes two bugs with "git init --separate-git-dir" when linked worktrees are involved (reported by [1]), both of which cause worktree administrative files to become outdated or corrupted. An intentional side-effect of the --separate-git-dir fix in patch [5/5] is that it closes an additional loophole not covered by [2] which made it illegal to use --separate-git-dir in conjunction with bare repositories. Peff is Cc:'d because he commented on that thread. [1]: https://lore.kernel.org/git/CAHbriek39i9NSHRw6DZm0dftk-GkeAYR74c0xyss0vbeDHu1Hw@xxxxxxxxxxxxxx/T/ [2]: https://lore.kernel.org/git/20200809225316.19503-1-sunshine@xxxxxxxxxxxxxx/T/ Eric Sunshine (5): worktree: add skeleton "repair" command worktree: teach "repair" to fix worktree back-links to main worktree worktree: teach "repair" to fix outgoing links to worktrees init: teach --separate-git-dir to repair linked worktrees init: make --separate-git-dir work from within linked worktree Documentation/git-worktree.txt | 26 ++++- builtin/init-db.c | 26 +++++ builtin/worktree.c | 29 ++++++ t/t0001-init.sh | 28 ++++++ t/t2406-worktree-repair.sh | 169 +++++++++++++++++++++++++++++++++ worktree.c | 127 +++++++++++++++++++++++++ worktree.h | 22 +++++ 7 files changed, 425 insertions(+), 2 deletions(-) create mode 100755 t/t2406-worktree-repair.sh -- 2.28.0.461.g40977abb40