feat: line-level stage hunk in quick diff viewer (SourceTree style)#18
Merged
Conversation
When a pending file is selected in the Quick Diff panel, each changed line now shows a [+] / [−] button on the right side on hover. Consecutive changed lines without context between them form a block; clicking the button on any line in the block stages (or unstages) the entire contiguous block at once. - diff-parser.ts: parse unified diff into hunks with per-line numbers and blockId grouping; buildBlockPatch() reconstructs a minimal valid patch for a single block - InteractiveDiffViewer.tsx: new component rendering the diff with per-block hover highlight and stage/unstage buttons - LeftSidebar.tsx: use InteractiveDiffViewer for non-untracked pending previews; add localRefresh to reload diff after patch apply - git-api.ts: add gitApplyPatch() invoking new apply_patch command - history.rs: add apply_patch Tauri command (writes to temp file, runs git apply [--cached] [--reverse]) - lib.rs: register apply_patch command https://claude.ai/code/session_014c1PNzrbhDMkL3uomdZGYc
…ailure
diff.split("\n") produces a trailing "" when the diff ends with "\n".
This was parsed as a context line inside the hunk, making oldCount /
newCount one too large. git apply then looked for a non-existent line
and failed with "patch does not apply".
The same skip is already in place for "\ No newline at end of file"
lines, so we extend the condition to cover the empty string case.
https://claude.ai/code/session_014c1PNzrbhDMkL3uomdZGYc
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.
$(cat <<'EOF'
Summary
[+]/[−]버튼이 hover 시 표시됩니다.변경 파일
src/lib/diff-parser.ts(신규)src/components/shared/InteractiveDiffViewer.tsx(신규)src/lib/git-api.tsgitApplyPatch()추가src/lib/index.tsdiff-parserexport 추가src/components/layout/LeftSidebar.tsxInteractiveDiffViewer사용,localRefresh추가src-tauri/src/git/parsers/history.rsapply_patchTauri command 추가 (임시파일 →git apply [--cached] [--reverse])src-tauri/src/lib.rsapply_patchcommand 등록동작 방식
Test plan
[+]버튼 확인[+]클릭 후 해당 블록이 staged files로 이동되는지 확인[−]버튼으로 부분 unstage 확인https://claude.ai/code/session_014c1PNzrbhDMkL3uomdZGYc
EOF
)
Generated by Claude Code