-
Notifications
You must be signed in to change notification settings - Fork 10
feat: default worktrees under .git/wtp/worktrees with legacy warning #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes the default worktree directory structure by moving from ../worktrees to .git/wtp/worktrees, keeping all worktree-related files within the repository's .git directory. A backward-compatible warning system alerts users with existing legacy worktree directories.
Key Changes:
- Default worktree base directory changed from
../worktreesto.git/wtp/worktrees - Added legacy directory detection with helpful migration warning
- Comprehensive test suite and documentation updates across the codebase
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/config/config.go | Updates default base directory constant and adds ConfigFileExists helper function |
| internal/config/config_test.go | Updates tests to use new default path constant and adds ConfigFileExists test coverage |
| cmd/wtp/legacy_warning.go | Implements warning logic to detect legacy ../worktrees directories when no config exists |
| cmd/wtp/legacy_warning_test.go | Comprehensive test coverage for legacy warning scenarios |
| cmd/wtp/add.go | Integrates legacy warning into the add command workflow |
| cmd/wtp/cd.go | Integrates legacy warning into the cd command workflow |
| cmd/wtp/list.go | Integrates legacy warning into the list command workflow |
| cmd/wtp/remove.go | Integrates legacy warning into the remove command workflow |
| cmd/wtp/init.go | Updates template configuration to use new default base directory |
| cmd/wtp/init_test.go | Verifies init command generates config with new default path |
| test/e2e/worktree_test.go | Updates end-to-end tests to use new default worktree paths |
| test/e2e/hook_streaming_test.go | Updates hook streaming tests with new default path and comment |
| cmd/wtp/remove_test.go | Updates all test fixtures with new default worktree path structure |
| cmd/wtp/cd_test.go | Updates test fixtures to reflect new default path |
| cmd/wtp/list_test.go | Updates all test cases to use new default base directory constant |
| internal/command/executor_test.go | Updates command executor tests with new default paths |
| docs/architecture.md | Updates architecture documentation with new default directory structure |
| README.md | Updates user-facing documentation with new default paths and directory structure examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WalkthroughDefault worktree base directory changed from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
internal/config/config.go (1)
45-189: RenameConfigFileExiststo satisfy lint and avoid stuttering package nameThe new default
DefaultBaseDir = ".git/wtp/worktrees"and the use of this constant inLoadConfiglook consistent and correct.The main issue is the exported helper:
// ConfigFileExists reports whether the config file exists in the given repository root. func ConfigFileExists(repoRoot string) bool { ... }Static analysis correctly notes that
config.ConfigFileExistsstutters the package name; this will keep the lint job red.Consider renaming it to avoid the stutter, e.g.:
-// ConfigFileExists reports whether the config file exists in the given repository root. -func ConfigFileExists(repoRoot string) bool { +// FileExists reports whether the config file exists in the given repository root. +func FileExists(repoRoot string) bool {and update call sites accordingly. Behavior (path cleaning,
os.Stat, and conservativefalseon errors) is otherwise fine.test/e2e/worktree_test.go (1)
145-160: Aligns e2e paths with new base_dir; split long git command line for linterThe e2e updates correctly move expectations from legacy
../worktreesto.git/wtp/worktrees, both for the remove‐outside‐base_dir case and for post‐create hooks.There is one linter issue on the long
env.RunInDirline in the RemoveOnlyWorksWithinBaseDir test; you can fix it by splitting arguments:- env.RunInDir(repo.Path(), "git", "worktree", "add", ".git/wtp/worktrees/feature/remove-test", "-b", "feature/remove-test") + env.RunInDir( + repo.Path(), + "git", + "worktree", + "add", + ".git/wtp/worktrees/feature/remove-test", + "-b", + "feature/remove-test", + )This keeps behavior identical while satisfying the
lll(max line length) rule.Also applies to: 275-292
🧹 Nitpick comments (1)
cmd/wtp/init.go (1)
65-102: Config template now matches new default base_dirThe generated
.wtp.ymlnow usesbase_dir: .git/wtp/worktrees, matchingconfig.DefaultBaseDirand the rest of the PR. Looks good.If you ever find this drifting again, you might consider building this string with
config.DefaultBaseDirinstead of a hard-coded literal, but that’s strictly optional.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
README.md(5 hunks)cmd/wtp/add.go(1 hunks)cmd/wtp/cd.go(1 hunks)cmd/wtp/cd_test.go(2 hunks)cmd/wtp/init.go(1 hunks)cmd/wtp/init_test.go(1 hunks)cmd/wtp/legacy_warning.go(1 hunks)cmd/wtp/legacy_warning_test.go(1 hunks)cmd/wtp/list.go(1 hunks)cmd/wtp/list_test.go(13 hunks)cmd/wtp/remove.go(1 hunks)cmd/wtp/remove_test.go(15 hunks)docs/architecture.md(3 hunks)internal/command/executor_test.go(4 hunks)internal/config/config.go(3 hunks)internal/config/config_test.go(6 hunks)test/e2e/hook_streaming_test.go(1 hunks)test/e2e/worktree_test.go(4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Follow standard Go style with tabs and gofmt; package names must be short and lowercase
Keep import groups tidy; use goimports for organization with local prefix following module pathgithub.com/satococoa/wtp/v2
Adhere to linting rules in.golangci.yml(vet, staticcheck, gosec, mnd, lll=120)
Wrap errors with context; avoid ignoring errors in Go code
Use snake_case for Go filenames (e.g.,remove.go,shell_integration.go)
Document exported items in Go when non-trivial; follow godoc conventions
Files:
test/e2e/hook_streaming_test.gocmd/wtp/add.gocmd/wtp/cd_test.gocmd/wtp/list.gotest/e2e/worktree_test.gocmd/wtp/legacy_warning.gointernal/config/config.gocmd/wtp/init_test.gocmd/wtp/remove.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gocmd/wtp/init.gointernal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
**/*_test.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*_test.go: Unit tests must be placed alongside packages as*_test.gofiles in the same directory
Target 70% code coverage with unit tests focusing on fast feedback and mocked git interactions using table-driven test cases
Files:
test/e2e/hook_streaming_test.gocmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/init_test.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gointernal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.go
test/e2e/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
End-to-end tests must be placed in
test/e2eand exercise real git workflows using the built binary
Files:
test/e2e/hook_streaming_test.gotest/e2e/worktree_test.go
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Worktree naming convention: main worktree is rendered as `@`; non-main worktrees display path relative to `base_dir` (e.g., `.worktrees/feat/hoge` → `feat/hoge`)
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Run commands from inside a worktree to mimic real usage (e.g., `go run ../cmd/wtp add feature/new-feature`)
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Shell integration must separate completion and hooks for clarity; `wtp cd` outputs absolute worktree path with no side effects
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Worktree naming convention: main worktree is rendered as `@`; non-main worktrees display path relative to `base_dir` (e.g., `.worktrees/feat/hoge` → `feat/hoge`)
Applied to files:
README.mdcmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/init.godocs/architecture.mdinternal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Run commands from inside a worktree to mimic real usage (e.g., `go run ../cmd/wtp add feature/new-feature`)
Applied to files:
README.mdtest/e2e/hook_streaming_test.gocmd/wtp/add.gocmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/legacy_warning.gocmd/wtp/init_test.gocmd/wtp/remove.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gocmd/wtp/init.godocs/architecture.mdinternal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Shell integration must separate completion and hooks for clarity; `wtp cd` outputs absolute worktree path with no side effects
Applied to files:
README.mdtest/e2e/hook_streaming_test.gocmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/init.godocs/architecture.mdcmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Branch naming must follow conventions: `feature/...`, `fix/...`, `hotfix/...` to align with worktree paths
Applied to files:
README.mdcmd/wtp/cd_test.godocs/architecture.mdcmd/wtp/remove_test.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Applies to .wtp.yml : Project hooks must be defined in `.wtp.yml`; keep commands deterministic and safe, avoiding destructive steps by default
Applied to files:
README.mdcmd/wtp/init.godocs/architecture.md
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Toggle shell integration paths with `WTP_SHELL_INTEGRATION=1` when testing cd behavior
Applied to files:
README.mddocs/architecture.md
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Applies to test/e2e/**/*.go : End-to-end tests must be placed in `test/e2e` and exercise real git workflows using the built binary
Applied to files:
test/e2e/hook_streaming_test.gocmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/init_test.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gointernal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Applies to **/*_test.go : Target 70% code coverage with unit tests focusing on fast feedback and mocked git interactions using table-driven test cases
Applied to files:
test/e2e/hook_streaming_test.gocmd/wtp/cd_test.gotest/e2e/worktree_test.gocmd/wtp/init_test.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gointernal/config/config_test.gocmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: CLI entrypoint is located at `cmd/wtp`; new command implementations must integrate with the main CLI structure
Applied to files:
cmd/wtp/add.gocmd/wtp/cd_test.gocmd/wtp/list.gocmd/wtp/legacy_warning.gocmd/wtp/init_test.gocmd/wtp/remove.gocmd/wtp/legacy_warning_test.gointernal/command/executor_test.gocmd/wtp/init.godocs/architecture.mdcmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: The root module is `github.com/satococoa/wtp/v2` running on Go 1.24; maintain module path consistency
Applied to files:
cmd/wtp/add.gocmd/wtp/cd_test.gocmd/wtp/legacy_warning.gocmd/wtp/init_test.gocmd/wtp/remove.gocmd/wtp/init.godocs/architecture.mdcmd/wtp/list_test.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Applies to **/*.go : Keep import groups tidy; use goimports for organization with local prefix following module path `github.com/satococoa/wtp/v2`
Applied to files:
cmd/wtp/cd_test.gocmd/wtp/legacy_warning.gocmd/wtp/init_test.gocmd/wtp/remove.gocmd/wtp/init.gocmd/wtp/remove_test.gocmd/wtp/cd.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Applies to **/*_test.go : Unit tests must be placed alongside packages as `*_test.go` files in the same directory
Applied to files:
cmd/wtp/cd_test.gocmd/wtp/legacy_warning_test.gointernal/config/config_test.gocmd/wtp/remove_test.go
📚 Learning: 2025年12月02日T13:33:48.673Z
Learnt from: CR
Repo: satococoa/wtp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025年12月02日T13:33:48.673Z
Learning: Use `go run ./cmd/wtp <args>` for rapid feedback during development instead of building binaries
Applied to files:
cmd/wtp/cd_test.gocmd/wtp/init.godocs/architecture.mdcmd/wtp/cd.go
🧬 Code graph analysis (9)
cmd/wtp/list.go (1)
internal/config/config.go (1)
LoadConfig(54-94)
cmd/wtp/legacy_warning.go (1)
internal/config/config.go (3)
ConfigFileExists(176-189)DefaultBaseDir(45-45)ConfigFileName(41-41)
cmd/wtp/remove.go (2)
internal/git/repository.go (1)
NewRepository(20-25)internal/errors/errors.go (1)
NotInGitRepository(11-19)
cmd/wtp/legacy_warning_test.go (1)
internal/config/config.go (1)
ConfigFileName(41-41)
internal/command/executor_test.go (1)
internal/command/builders.go (2)
GitWorktreeAdd(13-46)GitWorktreeAddOptions(5-10)
internal/config/config_test.go (1)
internal/config/config.go (4)
Defaults(20-22)DefaultBaseDir(45-45)ConfigFileExists(176-189)ConfigFileName(41-41)
cmd/wtp/list_test.go (1)
internal/config/config.go (2)
Defaults(20-22)DefaultBaseDir(45-45)
cmd/wtp/remove_test.go (1)
internal/command/types.go (1)
Command(4-8)
cmd/wtp/cd.go (2)
internal/git/repository.go (1)
NewRepository(20-25)internal/errors/errors.go (1)
NotInGitRepository(11-19)
🪛 GitHub Actions: CI
cmd/wtp/legacy_warning.go
[error] 35-35: golangci-lint: Error return value of fmt.Fprintf is not checked (errcheck).
🪛 GitHub Check: Lint
test/e2e/worktree_test.go
[failure] 145-145:
The line is 124 characters long, which exceeds the maximum of 120 characters. (lll)
cmd/wtp/legacy_warning.go
[failure] 36-36:
Error return value of fmt.Fprintf is not checked (errcheck)
[failure] 35-35:
Error return value of fmt.Fprintf is not checked (errcheck)
internal/config/config.go
[failure] 176-176:
exported: func name will be used as config.ConfigFileExists by other packages, and that stutters; consider calling this FileExists (revive)
🔇 Additional comments (15)
test/e2e/hook_streaming_test.go (1)
49-51: E2E expectation aligned with new default worktree base_dirThe test now asserts the worktree under
<repo>/.git/wtp/worktrees/test-branch, which matches the newDefaultBaseDir. The use offilepath.Joinkeeps it portable.cmd/wtp/add.go (1)
68-73: Legacy base-dir warning wiring looks correctUsing
cmd.Root().ErrWriter(falling back toos.Stderr) and callingwarnLegacyBaseDir(errWriter, mainRepoPath)before command execution is a good pattern and keeps warnings off the normal output stream. This is consistent with the rest of the CLI.cmd/wtp/list.go (1)
107-121: Consistent legacy-base-dir warning onlistThe addition of
errWriter(defaulting toos.Stderr) andwarnLegacyBaseDir(errWriter, mainRepoPath)keeps legacy warnings consistent with other commands and correctly routes them to the error stream instead of stdout. No functional issues spotted here.cmd/wtp/init_test.go (1)
133-157: Test expectation correctly updated for new base_dirThe success test now checks for
base_dir: .git/wtp/worktrees, matching the updated init template and config default. This keeps the test aligned with the new behavior.cmd/wtp/cd_test.go (1)
20-52: cd tests now track the new default worktree locationThe worktree list fixture and both expected paths have been updated to
/Users/dev/project/main/.git/wtp/worktrees/feature/auth, which matches the new default base_dir. This keeps the "absolute path" guarantees tested without changing test intent.README.md (1)
15-341: Documentation correctly reflects new worktree base_dirAll updated references to the default worktree location (
.git/wtp/worktrees/...) in the feature description, quick-start examples, config snippet, and Worktree Structure diagram now match the code’sDefaultBaseDirand the test expectations. The narrative and examples are consistent with the new layout.docs/architecture.md (1)
103-116: Docs align with new.git/wtp/worktreesdefault and cd behaviorThe configuration example, cd flow, and path-handling description all correctly reference
.git/wtp/worktrees, matching the newDefaultBaseDirand shell integration behavior. No issues from an architecture/docs perspective.Also applies to: 164-175, 213-216
internal/command/executor_test.go (1)
19-20: Executor/builder tests correctly updated to new base_dirThe updated expected paths under
.git/wtp/worktrees/featurekeep these tests aligned with the new default base_dir and theGitWorktreeAdd/GitWorktreeRemovebuilders. No further changes needed.Also applies to: 38-39, 168-177, 182-183, 194-195
cmd/wtp/remove.go (1)
84-104: Legacy warning wiring inremovelooks correctUsing
git.NewRepositoryto derivemainRepoPath, then sendingwarnLegacyBaseDiroutput tocmd.Root().ErrWriter(with sensible fallbacks) integrates the legacy base_dir warning cleanly intoremovewithout changing existing removal behavior.cmd/wtp/cd.go (1)
59-81:cdnow correctly emits legacy warnings using main repo pathDeriving
mainRepoPathfrom the repository and routingwarnLegacyBaseDirto the command’s error writer integrates the legacy base_dir warning intowtp cdwithout affecting its core behavior (absolute path output only). This is consistent with how other commands handle the warning.internal/config/config_test.go (1)
21-23: Config tests now trackDefaultBaseDirand cover config existenceSwitching assertions to
DefaultBaseDirremoves hard‐coding of the old../worktreesdefault, and the newTestConfigFileExistsgives good coverage of the config presence helper. The updatedResolveWorktreePathexpectations match the new.git/wtp/worktrees/...layout.Also applies to: 98-113, 171-190, 356-384
cmd/wtp/list_test.go (1)
138-140: List tests correctly updated to useconfig.DefaultBaseDirwhere appropriateUsing
config.DefaultBaseDirin list tests keeps them in sync with the new default base_dir while still overriding to.worktreesin scenarios that explicitly exercise non-default configurations. The overall coverage of formatting, path display, and quiet mode remains intact.Also applies to: 215-217, 268-270, 298-300, 368-369, 795-803, 894-895, 945-952, 989-990, 1027-1028, 1145-1147, 1233-1235
cmd/wtp/legacy_warning_test.go (1)
12-83: Legacy warning tests cover all key branches cleanlyThe three tests nicely exercise: (1) legacy
../worktreespresent with no config (warning expected), (2) legacy dir plus config (no warning), and (3) no legacy dir (no warning). Usingt.TempDir, concrete placeholder files, and substring assertions on both the legacy-directory wording andconfig.ConfigFileNameshould make regressions inwarnLegacyBaseDireasy to catch while staying decoupled from the exact message format. This looks solid as-is.cmd/wtp/remove_test.go (2)
45-52: Worktree path literals consistently updated to.git/wtp/worktreesAcross the remove-command tests (resolution, command construction, success/dirty flows, branch deletion, i18n/space-containing paths, and multiple-match selection), the mocked
git worktree listoutput and expected remove targets now uniformly use the new.git/wtp/worktrees/...base. The scenarios still exercise the same behavioral surface area and edge cases as before, just with the updated layout, so this aligns well with the PR’s default-base-dir objective.Also applies to: 54-60, 132-195, 233-297, 353-370, 394-442, 444-464, 466-552, 554-648, 652-704, 706-733, 735-791
353-370: Confirm intended main worktree path inTestRemoveCommand_WorktreeNotFoundHere the only listed worktree is mocked as
worktree /path/to/main/.git/wtp/worktrees/mainfor therefs/heads/mainentry. In many setupsgit worktree listreports the primary worktree at the repo root (e.g.,/path/to/main) with additional worktrees under the configured base directory. If any of your parsing or display logic distinguishes the main worktree by comparing its path to the repo root, this mocked layout might diverge from actual output and slightly weaken the realism of the test.If main is indeed represented under
.git/wtp/worktrees/mainin your flow, then this is fine; otherwise, consider switching this mock back to/path/to/mainto preserve that invariant.
satococoa
commented
Dec 25, 2025
Updating the direction for this PR: instead of changing the default worktree base dir to .git/wtp/worktrees, I’d like to switch the default to ../wtp/<repo>/.
Rationale:
- Keeps worktrees out of the repo working tree (no
git statusnoise, no need for.gitignore) - Avoids relying on
.gitinternals /.git-file vs.git-dir edge cases - Reduces collisions across multiple repos (namespacing by
<repo>), while keeping the location easy to discover (near the repo)
I still think the "legacy warning when ../worktrees exists and no config is present" approach in this PR is great for migration, so I’ll keep that mechanism and just adjust:
- new default:
../wtp/<repo>/ - legacy detection:
../worktrees+ no config → emit a warning for a limited period
I’ll update docs and tests accordingly in the next commits.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Testing
Summary by CodeRabbit
New Features
Changes
.git/wtp/worktrees(replaces previous../worktrees).Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.