diff options
| author | Paul Hinze <phinze@phinze.com> | 2026-03-30 17:49:59 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-30 23:49:59 +0100 |
| commit | dcfbe9fd2c8d248eb9edecd0be1f6a8a35e2d1de (patch) | |
| tree | fe744796fcc6e98a676cdabb0f2ca8ffa6a79cf7 /crates/atuin-client/tests/data | |
| parent | chore: Update to eye-declare 0.3.0 (#3365) (diff) | |
| download | atuin-dcfbe9fd2c8d248eb9edecd0be1f6a8a35e2d1de.zip | |
fix: resolve git worktrees to main repo in workspace filter (#3366)
Fixes #3364
## Summary
When using `filter_mode = "workspace"`, each git worktree gets its own
isolated history scope instead of sharing history with the main
checkout.
## Root cause
`in_git_repo()` walks up the directory tree looking for a `.git` entry.
In a worktree, `.git` is a file (not a directory) containing a `gitdir:`
pointer back to the main repo's `.git/worktrees/<name>`. Since
`has_git_dir()` just checks `.exists()`, the worktree's own path becomes
the workspace root, and the `WHERE cwd LIKE '<root>%'` filter isolates
its history from the main repo and other worktrees.
## Fix
Add `resolve_git_worktree()`, which reads the `.git` file when it's not
a directory, parses the `gitdir:` pointer, and walks back up to find the
parent containing a real `.git` directory. No new dependencies -- just a
bit of file reading and path traversal.
## Testing
Two new tests in `utils::tests`:
- `in_git_repo_regular` -- baseline that normal repos still resolve
correctly
- `in_git_repo_worktree_resolves_to_main_repo` -- creates a simulated
worktree layout and verifies it resolves to the main repo root
Both pass locally, along with the full `atuin-common` test suite and
`cargo clippy -- -D warnings`.
---
Disclosure: I'm a Rust novice, and I put this together with help from
Claude Code. I'm eager to learn more, so please let me know if anything
doesn't feel like idiomatic Rust!
## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
Diffstat (limited to 'crates/atuin-client/tests/data')
0 files changed, 0 insertions, 0 deletions
