Conversation
Entire-Checkpoint: 5e0e77648a11
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6f18f10. Configure here.
There was a problem hiding this comment.
Pull request overview
Fixes false carry-forward detection during manual-commit shadow-branch cleanup when Git line-ending normalization (e.g., core.autocrlf=true) causes working-tree bytes to differ from committed blob bytes even though Git considers the path clean.
Changes:
- Update
workingTreeMatchesCommitto consultgit diff --quietbefore falling back to raw blob hashing. - Add a regression test intended to cover the
core.autocrlfnormalization scenario.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
cmd/entire/cli/strategy/content_overlap.go |
Uses Git’s cleanliness check to avoid phantom carry-forward due to clean/smudge normalization. |
cmd/entire/cli/strategy/content_overlap_test.go |
Adds a test case meant to validate the autocrlf-normalization behavior. |
The call chain from PostCommit passes an unbounded context, so workingTreeMatchesCommit could block forever on a hung git process. Thread the caller's context through and wrap it with a 5s timeout, matching the pattern used by resolveWorktreeBranchGit for similar local git operations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 8b5b4eca788e
|
Follow-up: add 5s timeout to
|
|
Follow-up: distinguish
|
Exit 1 means "file is dirty" and should return false immediately, not fall through to raw blob hashing which can re-introduce the autocrlf mismatch. Only fall back to blob hash on actual git failures (exit 128+, timeout). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: e4ee6688a68c
e055706 to
cff083c
Compare

Fixed a false carry-forward bug in manual-commit shadow branch cleanup when Git line-ending normalization is enabled.
In the failing Codex E2E path, the second edit left
src/main.goin a CRLF-normalized working-tree form while the committed blob was LF-normalized undercore.autocrlf=true. Our carry-forward logic compared raw on-disk bytes to the commit blob hash, treated that as a dirty file, and incorrectly recreated a shadow branch after the user had already committed the full change.This change updates
workingTreeMatchesCommitto ask Git whether the path is clean before falling back to raw blob hashing. That makes the decision respect Git’s clean/smudge behavior and avoids phantom carry-forward on line-ending-only differences. It also adds a regression test covering theautocrlfnormalization case.Note
Medium Risk
Changes carry-forward detection to shell out to
git difffor cleanliness checks, which can affect behavior across environments (git availability/config) and could alter which files are carried forward in edge cases.Overview
Fixes a false-positive carry-forward case by updating
workingTreeMatchesCommitto first ask Git (git diff --quiet) whether a path is clean, instead of relying solely on hashing raw on-disk bytes (which can disagree undercore.autocrlfand other clean/smudge filters).Adds a regression test that enables
core.autocrlf=trueand verifies line-ending-only normalization does not cause files to be treated as having remaining agent changes.Reviewed by Cursor Bugbot for commit 6f18f10. Configure here.