Skip to content

fix(fetch): check target worktree for dirty state instead of current worktree#213

Merged
avihut merged 1 commit intomasterfrom
daft-186/gwtfetch-fails-on-dirty-branch
Feb 16, 2026
Merged

fix(fetch): check target worktree for dirty state instead of current worktree#213
avihut merged 1 commit intomasterfrom
daft-186/gwtfetch-fails-on-dirty-branch

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Feb 16, 2026

Summary

  • Fixed git worktree-fetch incorrectly skipping clean target worktrees when the current worktree has uncommitted changes
  • The dirty check now uses has_uncommitted_changes_in(target_path) which explicitly evaluates the target worktree, not the CWD
  • Added regression tests for both directions: clean target from dirty CWD, and dirty target from clean CWD

Fixes #186

Test Plan

  • mise run clippy passes with zero warnings
  • mise run fmt — no formatting changes needed
  • All 310 unit tests pass
  • All 17 fetch integration tests pass (including 2 new tests)
  • New test fetch_clean_target_from_dirty_worktree validates the exact bug scenario
  • New test fetch_dirty_target_from_clean_worktree validates the converse still works

🤖 Generated with Claude Code

…worktree

The dirty-worktree check in `git worktree-fetch` was using
`has_uncommitted_changes()` which evaluated the current working directory
instead of the target worktree. This caused fetches to be incorrectly
skipped when the current worktree was dirty but the target was clean.

Switched to `has_uncommitted_changes_in(target_path)` which explicitly
checks the target worktree path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut added this to the v1.1.0 milestone Feb 16, 2026
@avihut avihut added bug Something isn't working fix Bug fix labels Feb 16, 2026
@avihut avihut self-assigned this Feb 16, 2026
@avihut avihut merged commit e1215de into master Feb 16, 2026
4 checks passed
@avihut avihut deleted the daft-186/gwtfetch-fails-on-dirty-branch branch February 16, 2026 12:14
This was referenced Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gwtfetch to clean branch fails when executed on dirty branch

1 participant