Repository navigation
Compare Worktree Paths, Not Strings, in carry.py's Registration Check - #2485
Conversation
verify_target matched each `git worktree list --porcelain` row against the native string of the resolved target. Git emits forward slashes on Windows while pathlib emits backslashes, so a registered worktree never matched and every carry.py subcommand refused it. Each row is now parsed and resolved as a path before comparing. apply_tree's change lines printed repository paths with the native separator too, so Windows reported owned\file.txt where Linux reported owned/file.txt. They now print in POSIX form on every host. Part of #1117. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The registration test only proved a respelled row is accepted, so a mutation that never refused, or that allowed a duplicate row, passed. Two subtests now drop the target's row and list it twice, and each must be refused. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2485 +/- ##
===========================================
+ Coverage 58.47% 58.50% +0.03%
===========================================
Files 16 16
Lines 8062 8066 +4
===========================================
+ Hits 4714 4719 +5
+ Misses 3348 3347 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues were identified.
0 open findings
What changed in this PR
Fixes cross-platform Git worktree registration checks in carry.py and standardizes reported paths to POSIX separators.
Changes:
- Compare resolved worktree paths.
- Reject missing or duplicate registrations.
- Add regression tests and normalize change-report paths.
| File | Description |
|---|---|
tests/test_carry.py |
Adds worktree registration regression coverage. |
scripts/carry.py |
Implements cross-platform matching and POSIX path output. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@coderabbitai review |
|
….py, and install-tools.ps1 (#2489) ## Summary Promotes four changes to `main`. Three are fixes from the Windows-host lane, each verified on a native Windows 11 host. - [#2484](#2484): the six `test_bootstrap` tests that execute `install-tools.sh` directly now skip off Linux instead of erroring with `WinError 193`. Linux CI still runs them. - [#2485](#2485): `carry.py`'s worktree-registration check compares resolved paths instead of strings, so it no longer refuses every registered worktree on Windows. Its change lines print POSIX paths on every host. - [#2486](#2486): `install-tools.ps1` reads a winget Version token that is not a version, such as `Unknown`, `<` or `>`, as an unread installed version. The tool reports `unknown` rather than `outdated`, and `-Install` leaves it alone instead of installing over it. - [#2482](#2482): `pr_review.py` reads Copilot's revised overview shape. Refs #2479. Closes #2473 Closes #1117 Closes #2258 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
carry.py'sverify_targetmatched eachgit worktree list --porcelainrow againstf"worktree {target.resolve()}"as a string. Git prints forward slashes on Windows andpathlibprints backslashes, so a correctly registered worktree never matched, and everycarry.pysubcommand refused it withtarget is not a registered git worktree.worktreerow is now parsed into a path and resolved before comparing, and exactly one must match the resolved target, so a missing or duplicated registration is still refused.apply_tree's change lines printed repository paths with the native separator,owned\file.txton Windows. They now print POSIX paths on every host, matching what the tests and Linux already expected.Part of #1117, a child of #1143.
Verification
python3 -m unittest tests.test_carry: the registration test and the three change-line tests now pass. The two errors that remain are symlink-creation privilege errors (WinError 1314), a separate class that spans several test files. It will be filed on its own.carry.gitso the target's row is spelled with a trailing/.. The old string compare rejects that on every OS, and the resolved compare accepts it. Two subtests drop the row and list it twice, and each must be refused. Run on this host against the basecarry.py, the test fails. Mutating the count check to< 1or< 0fails a subtest each.ruff checkandruff formatclean, pre-commit hook passed.local-strict-review: round 1 raised one finding, the missing refusal cases, fixed in 410442d. Round 2 found nothing.🤖 Generated with Claude Code