1

I'm using git-gui on Windows Vista (via msysgit), and I'm trying to make the diff area (the yellow one) display changes in office files (eg .xlsx - they are really zipped up .xml files)

In C:\Users\Daniel\

.gitconfig
[diff "zip"]
textconv = unzip -c -a

In repository: (As a side note, I'd rather have this in C:\Users\Daniel, what should I do?)

.gitattributes
*.xlsx diff=zip

After committing an .xlsx file, changing it and rescanning, I get this message:
Binary files a/notes/GaussianMountain.xlsx and b/notes/GaussianMountain.xlsx differ

Instead of an output listing the changes made! What's wrong?

Zeophlite
  • 1,587
  • 3
  • 18
  • 35
  • Try running `git check-attr diff notes/GaussianMountain.xlsx` – Lily Ballard Jan 16 '11 at 10:40
  • Why do you need it? Usually MS applications alter the file structure greatly on every save (especially if different versions are used). So diffing may show lots of unnecessary (and messed up) information – ssmir Jan 16 '11 at 10:54
  • I suspect this might be just due to your .gitconfig being in the wrong directory. Alternatively, perhaps unzip can't be found and you're not seeing the error in the gui? If you open up a git bash shell, change into the repository and try `git diff notes/GaussianMountain.xlsx` (or whatever you were doing before) - does that work? If not, try setting the config option in the repository with: `git config diff.zip.textconv "unzip -c -a"`. Also try `echo $HOME` there. The other thing to check is that your .gitattributes file is in the git repository rather than in your home directory. – Mark Longair Jan 16 '11 at 10:58
  • @Kevin Ballard, notes/GaussianMountain.xlsx: diff: zip – Zeophlite Jan 16 '11 at 11:10
  • @Mark Longair, .gitconfig's in the correct directory, it has my other git config stuff. Running git diff notes/GaussianMountain.xlsx, I get WARNING: terminal is not fully functional, but then pressing enter gives a vi style output of the diff (with + and -, etc). It's in the repository – Zeophlite Jan 16 '11 at 11:13
  • running "export TERM=msys" fixes diff, now it displays correctly and in colour – Zeophlite Jan 16 '11 at 11:20
  • @Zeophlite: so that would be consistent with git-gui and the git bash shell looking in different places for .gitconfig, wouldn't it? This thread http://groups.google.com/group/msysgit/browse_thread/thread/120d47b6111c17c0 suggests that if you set the environment variable HOME to C:\Users\Daniel\ that may force both to look in the same place, but perhaps that's out of date now. – Mark Longair Jan 16 '11 at 11:23
  • @Mark Longair: typing env into a cmd prompt gives me HOMEDRIVE=C: , HOMEPATH=\Users\Daniel and USERPROFILE=C:\Users\Daniel . The file C:\Program Files\Git\etc\profile has: if [ -z "$HOME" -o ! -d "$HOME" ]; then HOME="$HOMEDRIVE$HOMEPATH" if [ -z "$HOME" -o ! -d "$HOME" ]; then HOME="$USERPROFILE" fi fi So I'm guessing that's not the problem? Finally, I added the [diff "zip"] textconv = unzip -c -a lines to C:\Program Files\Git\etc\gitconfig, but that didn't fix it. – Zeophlite Jan 16 '11 at 11:44

1 Answers1

0

Update: it seems from the comments below that the problem for the questioner was needing a later version of git-gui / msysGit. However, there are a couple of other problems I had while trying to reproduce the issue, which are described below.

I think I managed to reproduce this: the problem seems to be that I had the checkbox "Use TextConv For Diffs and Blames" selected in Git Gui's Edit > Options... dialog. When I turned off that option, it worked fine -- counterintuitively, to my mind, although that's also documented on the TextConv page on the git wiki.

The other problem I had was that the converter I was testing with (strings) wasn't on my path, so I had to put a full path in my .gitconfig:

[diff "stringify"]
    textconv = c:/cygwin/bin/strings.exe

However, if this had been the problem for you I don't think you would have seen the "Binary files A and B differ" message at all, so I suspect it's the former causing the problem.

Mark Longair
  • 385,867
  • 66
  • 394
  • 320
  • Git gui doesn't have a "Use Textconv For Diffs and Blames" option in its Options dialog. Git gui's `Help > About` dialog says my version is: git-gui version 0.12.GITGUI ; git version 1.7.0.2.msysgit.0 ; Here's a screen shot of it: http://img560.imageshack.us/img560/3376/gitgui.png – Zeophlite Jan 17 '11 at 05:54
  • OK, I was using the latest version: git-gui version 0.13.GITGUI, git version 1.7.3.1.msysgit.0, and the options dialog definitely has the option in that version: http://mythic-beasts.com/~mark/git-gui-screenshot.png -- that said, there do seem to be bugs in this feature at the moment: when I started up git-gui again to take that screenshot I had to turn the option on and off again to get the text diffs to appear again :( If you get it to work that far, that would be worth reporting... – Mark Longair Jan 17 '11 at 06:24
  • Updating to msysgit 1.7.3.1 worked - the option "Use Textconv For Diffs and Blames" is checked, but its displaying properly. Thanks for your help Mark – Zeophlite Jan 17 '11 at 09:51
  • @Zeophlite: no problem - I've updated my answer to mention what your eventual solution was. – Mark Longair Jan 17 '11 at 11:56