Talon
Talon

Reputation: 1894

Git diff ignores textconv when provided paths

I have set up my git diff that when it is called on a binary file, it will use a custom program as textconv which is specified in the .gitconfig file. That will look like this

[diff "file"]
    textconv = python "'/path/to/program.py'"
    xfuncname = .*name=.*
[core]
    attributesfile = ~/.gitattributes

and in the .gitattributes file I have

*.file diff=file

This works fine if applied to my git repo and in a terminal. However, my company uses TortoiseGit as front end for git, which brings its own diff tools that i couldn't bring to work with a textconv option. Instead for viewing a diff I supplied a command like

cmd /K git diff %base %mine

The output will then be

diff --git "a/path/in/repo.file" "b/temporary/path/out/of/repo.file"
index e4ab82c..3c0f4d7 100644
Binary files "a/path/in/repo.file" and "b/temporary/path/out/of/repo.file" differ

Usually git would apply textconv to the binary files and will work without problem if instead of "%base", "HEAD" is provided. I suspect that git runs as if it was called with --no-index and ignores the .gitattributes file and therefore does not now that is has to apply the textconv.

Is there a way to get around that problem?

Upvotes: 4

Views: 1358

Answers (1)

blue112
blue112

Reputation: 56572

Force the textconv conversion with the --textconv option:

cmd /K git diff --textconv %base %mine

Upvotes: 4

Related Questions