Skip to content

feat: add wt.nogitignore and wt.noreadme config options#162

Draft
Nymphium wants to merge 2 commits intok1LoW:mainfrom
Nymphium:main
Draft

feat: add wt.nogitignore and wt.noreadme config options#162
Nymphium wants to merge 2 commits intok1LoW:mainfrom
Nymphium:main

Conversation

@Nymphium
Copy link
Copy Markdown

Summary

  • Add wt.nogitignore and wt.noreadme git config options to skip creating .gitignore and README.md in the worktree base directory
  • Refactor AddWorktree/AddWorktreeWithNewBranch to accept Config instead of CopyOptions (which was a redundant subset of Config)

Motivation

.gitignore and README.md creation 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 .gitignore created by git-wt (which contains *) can cause problems with certain tools.

For example, oxlint (which uses the ignore crate 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/AddWorktreeWithNewBranch now need Config for the new flags, CopyOptions (which was just a subset of Config, built rom it at every call site) was removed from their signatures. CopyOptions is now constructed internally in copyAfterAdd.

Nymphium and others added 2 commits March 24, 2026 16:45
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>
@k1LoW
Copy link
Copy Markdown
Owner

k1LoW commented Mar 28, 2026

@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.

@Nymphium
Copy link
Copy Markdown
Author

Thanks for pointing that out. I completely missed that it was an upstream issue. I'll change this to a draft for now 🙏

@Nymphium Nymphium marked this pull request as draft March 29, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants