RT-300: parse a file-to-symlink typechange's two diff blocks - #454
Merged
Merged
Conversation
git splits a typechange into a delete block and an add block for the one path, and GHD's DiffParser threw "Invalid hunk header format" on the second header, so glitter could neither show nor stage the file. - git-core parseFileDiff parses each block alone and joins the hunks, shifting unifiedDiffStart/End so selection indices stay unique - stagingDiff and commitDiff flag the result typechange - glitter shows a typechange diff read-only; it stages whole from its file row, since half a file and half a symlink is no stageable state Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
Comment |
Collaborator
Author
|
@coderabbitai pause |
Review of #454: - a Partial selection left from before a file became a symlink reached stageSelection at commit, and git apply wrote a corrupted regular file; stageSelection and discardSelection now refuse a typechange, and the commit-time rebuild drops such a Partial to None - the multiline ^ split also matched after a lone \r in a content line - commitDiff passes -M so a rename never reads as two blocks Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
✅ Action performedReviews paused. |
Re-review of #454: dropping the file silently left the commit either missing it with no word, or failing with a bare "commit failed". The rebuild now drops the Partial to None and refuses the commit with a notice naming the file, so a retry commits the rest. The range diff passes -M too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RT-300. When a file is replaced by a symlink (or back), git emits two
diff --gitblocks for that one path: a delete, then an add. The vendored GHD DiffParser threw "Invalid hunk header format" on the second header, so glitter could neither show nor stage the file.What changed
git-core
parseFileDiff(diff-hunks.ts) parses each block alone and joins the hunks, shiftingunifiedDiffStart/Endso every line keeps a unique selection indexstagingDiffandcommitDiffboth use it and settypechange: trueon such a diffglitter
buildDiffModelshows a typechange diff read-only (no stage bar, no line or hunk toggles)Guards (from the Opus review standing in for rate-limited CodeRabbit)
stageSelectionanddiscardSelectionrefuse a typechange (a leftover Partial reachedgit applyand wrote a corrupted regular file)\nonly, so a lone\rbeforediff --gitin a content line never splits a blockcommitDiffand the range diff pass-M, so a rename never reads as two blocksVerification
stagingDiff(hunks, unique indices, sources,stageFileFullygives100644 -> 120000 T), a committed typechange throughcommitDiff, and the model's read-only flag; all three failed before the fix-one -two -threethen+other.txt, the file-row toggle works, committing gives:100644 120000 ... T f.txt, and History shows the committed typechange🤖 Generated with Claude Code