Repository navigation
Since version 0.4.4, lsdiff and filterdiff have been incorrectly counting binary changes. #157
Description
Activity
to exemplify
git diff a54b9aa..b656bed | lsdiff -N
File #0 a/ConnectTimeoutTest.class File #0 a/MessageContentFactory.class File #0 a/UrlInitFilter.class File #0 a//MessageContentFactory File #0 a/MessageContentFactory1.class File #0 a/MessageContentFactory_.class File #1 b/bd/index.jsp File #2 b/css/Gest.css File #2 a/img/cir.png File #2 a/img/fdgb.png File #2 a/img/inacep.png File #2 a/img/inm.png File #3 a/Logo-03.svg File #4 a/Logo-04.svg- changed the title
[-]in version 0.4.4 lsdiff and filterdiff are counting binary changes[/-][+]Since version 0.4.4, lsdiff and filterdiff have been incorrectly counting binary changes.[/+]on Feb 23, 2026 I bisected the commits and the problem starts at commit bfab1d2
.Reacted by Tim WaughI just noticed that the error occurs when a binary file is created or deleted.
The bigger problem is that these messages are not being filtered.For example:
git diff a54b9aa..b656bed | patchview -F1 , print the file 1 and this:
Binary files /dev/null and b/ConnectTimeoutTest.class differ
Binary files a/MessageContentFactory copy.class and /dev/null differ
Binary files a/MessageContentFactory1.class and /dev/null differ
Binary files a/MessageContentFactory_.class and /dev/null differ
Binary files /dev/null and b/img/fdgb.png differ
Binary files /dev/null and b/img/inacep.png differ
Binary files /dev/null and b/img/inm.png differ- added 5 commits that reference this issue
on Feb 23, 2026 Fixed via #162. Thanks for the analysis!
I’ve been testing this all day and did not find any issues. It is fixed now.
However, I realized that in version 0.4.3 binary files did not appear in the listings. This is a compatibility break, and it may not even be useful to include binary files in the output.
I think we should at least provide an option in filterdiff to explicitly include or exclude binary files from the listings.
How about if we introduce a new parameter for filterdiff?
--git-extended-diffs=exclude|includewhich would default toexcludefor 0.4.x butincludefor 0.5.x (on master)? Some of these changes were made to fix reported bugs about git extended diffs being ignored.I’ve been checking, and it does seem that binary files only appear in git diff output. Therefore, the option name git-extended-diffs is correct, and I think your suggestion makes sense.
- added a commit that references this issue
on Feb 25, 2026 @sergiomb2 see what you think of this PR:
- added a commit that references this issue
on Feb 25, 2026 Close via #164
in version 0.4.4 lsdiff and filterdiff are counting binary changes
for example
cat example.patch|lsdiff -N
File #0 a/src/WEB-INF/lib/postgresql-jdbc.jar
File #0 a/src/font/Anton/Anton-Regular.ttf
the count begins in 1
also filterdiff shows all binary changes even if we ask just to show file #3 ( cat example.patch| filterdiff -F3)
diff --git a/src/WEB-INF/lib/postgresql-jdbc.jar b/src/WEB-INF/lib/postgresql-jdbc.jar
new file mode 100644
index 0000000..02bc736
Binary files /dev/null and b/src/WEB-INF/lib/postgresql-jdbc.jar differ
diff --git a/src/font/Anton/Anton-Regular.ttf b/src/font/Anton/Anton-Regular.ttf
new file mode 100644
index 0000000..c7d7455