From fb3d72b08484ed6fdb5fe0e267f799204b8a6a92 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 4 Nov 2026 10:04:47 -0800 Subject: [PATCH 1/2] quest: plan keeping .worktrees/ out of git status Co-Authored-By: Claude Opus 5.5 --- quest/m0/user-dev-shell/README.md | 1 + quest/m0/user-dev-shell/worktrees-exclude.md | 36 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 quest/m0/user-dev-shell/worktrees-exclude.md diff --git a/quest/m0/user-dev-shell/README.md b/quest/m0/user-dev-shell/README.md index 441ea38c..84eb017e 100644 --- a/quest/m0/user-dev-shell/README.md +++ b/quest/m0/user-dev-shell/README.md @@ -74,4 +74,5 @@ moq-dev/moq's `.codex/hooks/direnv.sh`. ## Required - [quest init writes no hooks](/quest/m0/user-dev-shell/init-hooks.md) - `quest init` stops writing hook entries and removes the ones it or a wrapper wrote; the docs describe the hooks as user-level opt-in +- [.worktrees/ stays out of git status](/quest/m0/user-dev-shell/worktrees-exclude.md) - `quest worktree` adds `/.worktrees/` to the clone's local exclude unless something ignores it - [Repositories drop dev-shell config](/quest/m0/user-dev-shell/repo-config.md) - quest, moq, moq.pro, rind, and rust2 drop their dev-shell hooks, Quest worktree hooks, and `nix develop` instructions diff --git a/quest/m0/user-dev-shell/worktrees-exclude.md b/quest/m0/user-dev-shell/worktrees-exclude.md new file mode 100644 index 00000000..59fffa52 --- /dev/null +++ b/quest/m0/user-dev-shell/worktrees-exclude.md @@ -0,0 +1,36 @@ +# [S] .worktrees/ stays out of git status + +## Goal + +When `quest worktree` creates a checkout under a repository's `.worktrees/`, +it adds `/.worktrees/` to that repository's `$GIT_COMMON_DIR/info/exclude` +unless something already ignores the directory, so the main checkout's +`git status` never lists `.worktrees/`. The exclude is local to the clone: +no repository change, and every checkout of it shares the file. + +## Plan + +Decided 2026-11-04 (user, /quest-complete follow-up of +[moq-dev/quest#466](https://github.com/moq-dev/quest/pull/466)). With +Quest's worktree hooks an opt-in in each user's own Claude settings, they +run in every repository the user opens, and a repository that doesn't ignore +`.worktrees/` shows `?? .worktrees/` in its main checkout (reproduced with +`git worktree add .worktrees/a` in a fresh repository; nothing in +`src/cli/worktree.ts` writes an exclude). + +- What should the quest's goal be? + - ✅ A local exclude written by `quest worktree` + - Rejected: telling users to add `.worktrees/` to their global gitignore; + leaving it +- Which milestone and epic? + - ✅ m0, in this epic beside the opt-in that exposed it + - Rejected: m1; m2 + +Implementation guidance: + +- Check with `git check-ignore` whether `.worktrees/` is already ignored, + by the repository, a global `core.excludesFile`, or an earlier exclude, + before appending. +- Test with a repository that has no ignore rule, one whose `.gitignore` + already lists `/.worktrees/`, and a second checkout, which must not + append the line again. From 64bbcff75e6827a0118fd146117b50af79d3181d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 4 Nov 2026 10:06:06 -0800 Subject: [PATCH 2/2] quest: worktrees-exclude queries .worktrees/ with its trailing slash Co-Authored-By: Claude Opus 5.5 --- quest/m0/user-dev-shell/worktrees-exclude.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quest/m0/user-dev-shell/worktrees-exclude.md b/quest/m0/user-dev-shell/worktrees-exclude.md index 59fffa52..db19df85 100644 --- a/quest/m0/user-dev-shell/worktrees-exclude.md +++ b/quest/m0/user-dev-shell/worktrees-exclude.md @@ -28,9 +28,12 @@ run in every repository the user opens, and a repository that doesn't ignore Implementation guidance: -- Check with `git check-ignore` whether `.worktrees/` is already ignored, - by the repository, a global `core.excludesFile`, or an earlier exclude, - before appending. +- Check with `git check-ignore`, as `ignored()` in `src/cli/worktree.ts` + does, whether `.worktrees/` is already ignored, by the repository, a + global `core.excludesFile`, or an earlier exclude, before appending. + Query it with the trailing slash: until the directory exists, + `git check-ignore .worktrees` misses a directory-only rule such as + `/.worktrees/`. - Test with a repository that has no ignore rule, one whose `.gitignore` already lists `/.worktrees/`, and a second checkout, which must not append the line again.