Summary
The skip list checks the directory base name .git, but only when entry.IsDir() is true:
if entry.IsDir() {
if _, skip := skipDirs[name]; skip {
return
}
fr.WalkDir(child)
} else if mode.IsRegular() {
fr.rewriteContents(child, entry)
}
Git submodules and git worktree checkouts use a .git file (not directory) containing gitdir: <path>. find-replace will happily rewrite that file, breaking the worktree linkage.
Impact (Reliability: Low)
- Find/replace runs in a worktree silently corrupt the
.git linkage file.
- The user has to manually restore it after the fact.
Suggested Fix
Skip any entry whose base name is .git, regardless of whether it's a file or a directory. Same for any other entries we choose to skip.
Files
find_replace.go:84-94 (handleEntry)
Summary
The skip list checks the directory base name
.git, but only whenentry.IsDir()is true:Git submodules and
git worktreecheckouts use a.gitfile (not directory) containinggitdir: <path>. find-replace will happily rewrite that file, breaking the worktree linkage.Impact (Reliability: Low)
.gitlinkage file.Suggested Fix
Skip any entry whose base name is
.git, regardless of whether it's a file or a directory. Same for any other entries we choose to skip.Files
find_replace.go:84-94(handleEntry)