Skip to content

Unable to diff a file with specific diff function #15974

Closed

Description

@esseivan

The problem

I am unable to diff a zip file (or any with diff=... in .gitattributes).
I set the command in the config (.git/config) file with

[diff "zip"]
	textconv = unzip -v

Then in the .gitattributes located in the root of my repository I specified :
*.zip diff=zip

When checking for a diff in Github Desktop, it doesn't load anything and prints an error in the developer tools window
Nothing interesting in the log file.

I tried with other stuff, as diff=astextplain but the same thing happens
Also to note that it works with the command line git commands

Release version

Version 3.1.4 (x64)

Operating system

Windows 11 x64

Steps to reproduce the behavior

  1. Clean repo with zip file
  2. .gitattributes with :
    *.zip diff=zip
  3. ./.git/config contains the diff :
[diff "zip"]
	textconv = unzip -v
  1. Edit zip file
  2. Check diff in Github Desktop for the zip file
  3. No diff loaded, infinite loading. Developer tools shows the following error

Log files

No response

Screenshots

image

Additional context

No response

Activity

  1. esseivan commented on Jan 26, 2023

    @esseivan
    Author

    After some debugging I found that the program exits at the line 135 of /app/src/lib/git/spawn.ts.
    But I do not get any descriptive message in the console, however, the stderr contained the information I needed :
    unzip -v: line 1: unzip: command not found\nfatal: unable to read files to diff\n
    So my issue just was that the command I set for the textconv was invalid (even though it works for the cmd-line git). To fix it, I added C:\Program Files\Git\usr\bin to the PATH variable.

    It could maybe be possible to also print the stderr instead of just printing the default error message (spawn.ts:135) with something like log.error(stderr.toString());

  2. tidy-dev commented on Jan 27, 2023

    @tidy-dev
    Contributor

    Thanks for doing that debugging. I am going to close this out since it sounds like you found a resolution. :)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions