← 返回首页
Fix UnifiedDiffReader to use correct DeltaType by andrewparmet · Pull Request #228 · java-diff-utils/java-diff-utils · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Fix UnifiedDiffReader to use correct DeltaType#228

Merged
wumpz merged 1 commit into
java-diff-utils:masterfrom
andrewparmet:fix/unified-diff-delta-types
May 16, 2026
Merged

Fix UnifiedDiffReader to use correct DeltaType#228
wumpz merged 1 commit into
java-diff-utils:masterfrom
andrewparmet:fix/unified-diff-delta-types

Conversation

Copy link
Copy Markdown

finalizeChunk() previously always created ChangeDelta regardless of whether the hunk contained only insertions, only deletions, or only context lines. This made it impossible for consumers to determine the actual type of change from the delta alone.

Now uses InsertDelta when a hunk contains only additions (no context), DeleteDelta when only deletions (no context), EqualDelta when only context, and ChangeDelta otherwise. Hunks with context lines still use ChangeDelta to preserve backward-compatible applyTo behavior.

Fixes #201.

finalizeChunk() previously always created ChangeDelta regardless of whether the hunk contained only insertions, only deletions, or only context lines. This made it impossible for consumers to determine the actual type of change from the delta alone. Now uses InsertDelta when a hunk contains only additions (no context), DeleteDelta when only deletions (no context), EqualDelta when only context, and ChangeDelta otherwise. Hunks with context lines still use ChangeDelta to preserve backward-compatible applyTo behavior. Fixes java-diff-utils#201

wumpz commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Thx for improving and using diff utils.

Hide details View details wumpz merged commit 61deff7 into java-diff-utils:master May 16, 2026
4 checks passed
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeltaType always assigned as CHANGE in UnifiedDiff.parseUnifiedDiff(InputStream stream)

3 participants

Footer

© 2026 GitHub, Inc.