I have configured my repository to be able to diff xlsx files making use of a filter called zippey. So far it is working well, but I am only able to diff HEAD vs. Index with the .xlsx file already staged.
zippey works by adding a filter:
- smudge:
git config filter.zippey.smudge "$PWD/zippey.py d" - clean:
git config filter.zippey.clean "$PWD/zippey.py e"
I have also added a [diff] stanza to .git/config following the advice in https://stackoverflow.com/a/42077620/5364231:
Tante recommended a very simple approach in Managing ZIP-based file formats in Git:
Open your ~/.gitconfig file (create if not existing already) and add the following stanza:
[diff "zip"]
textconv = unzip -c -a
But it seems that the filter is applied before the diff, because using the Compare with Unmodified command from Visual Studio Git window:
However, if I delete the filter and leave only the diff, even though the Compare with Unmodified command still fails, I am able to execute the diff via git bash:
git diff "C:\Users\user1\AppData\Local\Temp\TFSTemp\vctmp14420_631477.TestData.3c61211c.xlsx" $PWD/TestData.xlsx
So my questions are:
- Why is the
cleanfilter being applied when comparing files that are not staged? - Can this behaviour be prevented?
- Is it possible for the
[filter]and[diff]to coexist in this particular case? - Why am I able to
git difffiles with git bash but not using theCompare with Unmodifiedcommand?
Thanks a lot. Regards.
.git/config:
---------------------------------------------------------------------
[filter "zippey"]
clean = \"C:\\GIT\\zippey.py\" d
smudge = \"C:\\GIT\\zippey.py\" e
[diff "zip"]
textconv = \"$PWD\\unzip.exe\" -c -a