Skip to content

Extract UnifiedDiffSink #2102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cruessler
Copy link
Contributor

@cruessler cruessler commented Aug 4, 2025

This PR is an attempt at extracting a part of UnifiedDiff, more specifically a part that exposes an API for dealing with structured data as opposed to string-based data. It introduces ConsumeTypedHunk which is very similar to ConsumeHunk, except that is uses HunkHeader and DiffLineType to encode diff-related information in proper types.

There are still a few open issues/questions:

  • ConsumeTypedHunk is not NewlineSeparator-aware. Is that a good thing or a bad thing? I’m leaning more towards the former.
  • The PR contains a few TODO: comments.

What do you think about the PR’s overall design? If you think this works, I’d start addressing the remaining issues.

This PR was initially motivated by gitui-org/gitui#2685.

@cruessler cruessler marked this pull request as ready for review August 7, 2025 10:03
@cruessler cruessler marked this pull request as draft August 8, 2025 08:15
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.

1 participant