Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quest/m0/user-dev-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ moq-dev/moq's `.codex/hooks/direnv.sh`.

## Required

- [.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 and `nix develop` instructions
39 changes: 39 additions & 0 deletions quest/m0/user-dev-shell/worktrees-exclude.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# [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`, 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.