Skip to content

Since version 0.4.4, lsdiff and filterdiff have been incorrectly counting binary changes. #157

Description

@sergiomb2

in version 0.4.4 lsdiff and filterdiff are counting binary changes
for example

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    

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

Activity

  1. sergiomb2 commented on Feb 10, 2026

    @sergiomb2
    ContributorAuthor

    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
    
  2. 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
  3. sergiomb2 commented on Feb 23, 2026

    @sergiomb2
    ContributorAuthor

    I bisected the commits and the problem starts at commit bfab1d2
    .

  4. sergiomb2 commented on Feb 23, 2026

    @sergiomb2
    ContributorAuthor

    I 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

  5. twaugh commented on Feb 23, 2026

    @twaugh
    Owner

    Fixed via #162. Thanks for the analysis!

  6. sergiomb2 commented on Feb 24, 2026

    @sergiomb2
    ContributorAuthor

    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.

  7. reopened this on Feb 24, 2026
  8. twaugh commented on Feb 24, 2026

    @twaugh
    Owner

    How about if we introduce a new parameter for filterdiff? --git-extended-diffs=exclude|include which would default to exclude for 0.4.x but include for 0.5.x (on master)? Some of these changes were made to fix reported bugs about git extended diffs being ignored.

  9. sergiomb2 commented on Feb 24, 2026

    @sergiomb2
    ContributorAuthor

    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.

  10. twaugh commented on Feb 25, 2026

    @twaugh
    Owner

    @sergiomb2 see what you think of this PR:

  11. twaugh commented on Feb 26, 2026

    @twaugh
    Owner

    Close via #164

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions