Skip to content

fix: detect .worktrees/ ignore via git check-ignore#2

Merged
IamGroooooot merged 1 commit into
IamGroooooot:mainfrom
CoodingPenguin:fix/check-ignore-default-worktree
Apr 28, 2026
Merged

fix: detect .worktrees/ ignore via git check-ignore#2
IamGroooooot merged 1 commit into
IamGroooooot:mainfrom
CoodingPenguin:fix/check-ignore-default-worktree

Conversation

@CoodingPenguin
Copy link
Copy Markdown
Contributor

@CoodingPenguin CoodingPenguin commented Apr 27, 2026

Summary

  • Replace the .gitignore-grep guard for the default .worktrees/ root with a git check-ignore query, so global excludes and .git/info/exclude count as valid
  • Refine the rejection message to make the broader scope explicit
  • Add a bats case covering the .git/info/exclude path that was previously rejected
  • Update both READMEs to describe the new acceptance rules

Changes

  • cwt.sh: _cwt_ensure_default_worktree_ignored now delegates to git -C "$git_root" check-ignore -q .worktrees/, dropping the literal .gitignore regex scan
  • Messaging: warn/error strings switched from "in .gitignore" / "Refusing to edit .gitignore automatically" to "to be gitignored (local, global, or info/exclude)" / "Add .worktrees/ to your gitignore and rerun"
  • tests/cwt_new.bats: update the existing rejection assertions to the new strings; add accepts .worktrees/ ignored via .git/info/exclude covering the new code path
  • README.md / README.ko.md: clarify that any gitignore source (repo .gitignore, .git/info/exclude, global excludes) satisfies the requirement

Test plan

  • npx bats tests/cwt_new.bats — 44/44 passing, including the new .git/info/exclude case
  • Manual: empty repo .gitignore + global core.excludesFile listing .worktrees/cwt new proceeds
  • Manual: .git/info/exclude only → cwt new proceeds
  • Manual: no source ignores .worktrees/ → blocked with the new message

@IamGroooooot IamGroooooot merged commit 5916c50 into IamGroooooot:main Apr 28, 2026
4 checks passed
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