feat: add wt.nogitignore and wt.noreadme config options#162
feat: add wt.nogitignore and wt.noreadme config options#162Nymphium wants to merge 2 commits intok1LoW:mainfrom
Conversation
Allow users to disable automatic creation of .gitignore and README.md in the worktree base directory via git config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CopyOptions was a subset of Config, built from Config at every call site. Pass Config directly and construct CopyOptions internally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@Nymphium Thank you for your suggestion! It seems this is fundamentally a bug in oxlint (or the underlying ignore crate) oxc-project/oxc#17805 regarding repository boundary detection. When running inside a git worktree, oxlint fails to recognize the .git file as a stop point for its directory traversal. As a result, it leaks into parent directories and picks up the .gitignore from the base directory. Since that file contains a * wildcard, it ends up ignoring every file within the worktree. I'd like to hold off on this feature until we see how oxlint addresses oxc-project/oxc#17805. If they fix the traversal boundary issue, this workaround may not be needed. |
|
Thanks for pointing that out. I completely missed that it was an upstream issue. I'll change this to a draft for now 🙏 |
Summary
wt.nogitignoreandwt.noreadmegit config options to skip creating.gitignoreandREADME.mdin the worktree base directoryAddWorktree/AddWorktreeWithNewBranchto acceptConfiginstead ofCopyOptions(which was a redundant subset ofConfig)Motivation
.gitignoreandREADME.mdcreation in the base directory was introduced by #81. When placing worktrees in a subdirectory (e.g.,.worktrees/) that is already ignored by a global gitignore (~/.config/git/ignore), the.gitignorecreated bygit-wt(which contains*) can cause problems with certain tools.For example, oxlint (which uses the
ignorecrate in Rust) traverses parent directories looking for .gitignorefiles and applies them — so the*` pattern ends up ignoring all files from the tool's perspective.These new config options allow users to opt out of creating these files. The default behavior does not change.
Since
AddWorktree/AddWorktreeWithNewBranchnow needConfigfor the new flags,CopyOptions(which was just a subset ofConfig, built rom it at every call site) was removed from their signatures.CopyOptionsis now constructed internally incopyAfterAdd.