Skip to content

Commit 20f6608

Browse files
authored
Update notes.md (#16)
1 parent 86da0b5 commit 20f6608

1 file changed

Lines changed: 0 additions & 28 deletions

File tree

tools/wt-worktree/notes.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,30 +107,13 @@ wt-worktree/
107107
- No need to run `wt init` per repository
108108
- Lesson: Sometimes the simplest solution is the best - global config is easier than per-repo config for this use case
109109

110-
### Test Results
111-
112-
- **Total Tests**: 58
113-
- **Passed**: 58
114-
- **Coverage**: 63%
115-
- **Key Coverage Areas**:
116-
- git.py: 86% (core git operations well tested, including worktree detection)
117-
- config.py: 75% (configuration management tested)
118-
- worktree.py: 62% (worktree operations tested)
119-
- cli.py: 54% (CLI commands tested including secondary worktree usage)
120-
121110
7. **Missing Special Symbol Support in `wt run`**
122111
- Problem: The `wt run` command didn't support the `^` (default) and `-` (previous) symbols, while `wt switch` did
123112
- Error: Running `wt run ^ "git status"` or `wt run - "git diff"` resulted in "Error: Worktree not found"
124113
- Solution: Added special handling for both `^` and `-` symbols in the `run` command (cli.py:379-409) to resolve them before looking up the worktree
125114
- Implementation:
126115
- Added check `if name == "-":` to find the previous worktree from `.wt_previous` file and resolve it to the worktree name
127116
- Added check `elif name == "^":` to get the default worktree using `ctx.manager.get_default_worktree()` and use its name
128-
- Tests: Added five new tests in test_cli.py:
129-
- `test_run_command`: Tests running a command in a normal worktree
130-
- `test_run_command_with_default_symbol`: Tests running a command using `^` symbol
131-
- `test_run_command_with_previous_symbol`: Tests running a command using `-` symbol
132-
- `test_run_command_no_previous_worktree`: Tests error handling when no previous worktree exists
133-
- `test_run_command_nonexistent_worktree`: Tests error handling for non-existent worktrees
134117
- Lesson: Always ensure consistency across commands - if a special symbol works in one command, users will expect it to work in related commands too
135118

136119
8. **Implementing wt sync Command**
@@ -151,7 +134,6 @@ wt-worktree/
151134
- Initially used `error()` function which calls sys.exit, causing tests to fail
152135
- Fixed by using `warning()` function instead to print errors without exiting
153136
- This allows the command to continue syncing other worktrees after failures
154-
- Tests: Added 6 comprehensive tests covering all options and edge cases
155137
- Lesson: When implementing operations that process multiple items, use warning/info functions instead of error() to avoid early exit
156138

157139
9. **Detached Worktree Name Preservation**
@@ -167,16 +149,6 @@ wt-worktree/
167149
- Modified `list_worktrees()` to retrieve stored names or fallback to `(detached-<commit>)`
168150
- Fixed base branch selection: detached worktrees now use HEAD instead of default_base
169151
- Key Insight: Git's `--worktree` config flag requires `extensions.worktreeConfig` to be enabled first
170-
- Tests: Added 6 comprehensive tests for detached worktree creation, listing, switching, running commands, and deletion
171152
- Lesson: Per-worktree config in git requires enabling the worktreeConfig extension, and is the right way to store worktree-specific metadata
172153
- Backward Compatibility: Added `_infer_name_from_path()` to infer names from path patterns for detached worktrees created before this fix or via raw git commands
173154
- Fallback chain: stored config → inferred from path → `(detached-<commit>)`
174-
175-
### Future Improvements
176-
177-
1. **Increase CLI Test Coverage**: Add more edge case tests for CLI commands
178-
2. **Integration Tests**: Add end-to-end tests with real workflows
179-
3. **Shell Integration Tests**: Test actual shell wrapper execution
180-
4. **Error Message Tests**: Verify all error messages are clear and actionable
181-
5. **Performance**: Optimize git operations for large repositories
182-
6. **Sync with Remote Integration Tests**: Add tests with actual remote repositories to test full sync flow

0 commit comments

Comments
 (0)