Conversation
Two test cases added to reproduce GitHub issue #157, where binary files are incorrectly counted and filtered since commit bfab1d2. The lsdiff-binary-numbering test demonstrates that binary files get duplicate file numbers instead of sequential numbering. The filterdiff-binary-filtering test demonstrates that binary files leak through file number filters. Both tests currently fail and will pass once issue #157 is fixed. Assisted-by: Claude Code
Binary files were not incrementing the file counter, causing them to display duplicate file numbers when using lsdiff -N. The issue occurs in git diffs without hunks (binary files, mode changes, pure renames). These files break out of header processing and are handled separately by do_git_diff_no_hunks(), bypassing the normal filecount++ that happens when processing +++ headers. This fix adds filecount++ in both code paths that handle git diffs without hunks: - EOF case: when git headers are found at end of file - Non-EOF case: when git headers are followed by binary content With this fix, binary files are numbered sequentially like text files. Assisted-by: Claude Code
Binary files were not respecting the -F file number filter, causing them to appear in output even when their file number didn't match the requested range. The issue occurs because git diffs without hunks (binary files, mode changes, pure renames) bypass the normal hunk processing where file_matches() is called. These files check pattern filters (-i/-x) but never check the file number filter (-F). This fix adds file_matches() checks in both code paths that handle git diffs without hunks: - EOF case: when git headers are found at end of file - Non-EOF case: when git headers are followed by binary content With this fix, binary files respect -F filtering just like text files. Assisted-by: Claude Code
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 0.4.x #162 +/- ##
==========================================
+ Coverage 83.51% 83.60% +0.09%
==========================================
Files 5 5
Lines 4167 4173 +6
Branches 995 997 +2
==========================================
+ Hits 3480 3489 +9
+ Misses 687 684 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
twaugh
added a commit
that referenced
this pull request
Feb 23, 2026
Document the binary file handling fixes merged in PR #162: - Binary files now get sequential file numbers with lsdiff -N - Binary file messages now respect filterdiff -F filtering
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.
Description
Fixes #157.
Type of Change
Testing
Test cases added.