Skip to content
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

Ensure that completely ignored diff is empty #5893

Merged
merged 2 commits into from Feb 22, 2024
Merged

Conversation

ethomson
Copy link
Member

When all contents of a diff are ignored, the resulting buffer should be empty but is instead malformed (includes a header but no hunks).

(This adds a failing test only at this point.)

When a diff has no content -- for example, when there are only
whitespace changes, and they're being ignored -- we need to avoid
printing the file header. Queue the file header update until the first
hunk is printed, and display it then.
@ethomson ethomson merged commit 8fd4f83 into main Feb 22, 2024
18 checks passed
@ethomson ethomson deleted the ethomson/diff_fail branch February 22, 2024 13:39
@carlosmn
Copy link
Member

carlosmn commented Apr 3, 2024

It looks like this broke the tests at https://github.com/libgit2/rugged/blob/57257cbb7ea4b40debf5ec244e27ebffeaf40b16/test/diff_test.rb#L921 where we're just asking for the patch header. It looks like waiting to generate the patch header until we try to generate the content doesn't work if we never even wanted to generate any of the content but do want the header.

@ethomson
Copy link
Member Author

@carlosmn bleh. I suppose that instead of delaying sending the header until we send the first piece of content, we need to go find the first piece of content, and if there is some, enqueue it and deliver the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants