我可以从自定义二进制文件差异处理程序的回购级别 .gitconfig 文件中引用 git 回购吗?

Can I reference the git repo from a repo-level .gitconfig file for a custom binary-file diff handler?

我需要比较 Excel 个文件,所以我找到了 this great snippet of code and converted it to Python (here).

在 README 中,它对 configure/create 这些文件说: .gitconfig

[diff "xlsx"]
    binary = true
    textconv = python C:/Python27/Scripts/git-xlsx-textconv.py

.gitattributes

*.xlsx diff=xlsx

我了解到您可以拥有这些文件的回购级别版本,并希望使用回购的我的同事在执行下一个 pull[=16 后无缝地拥有此功能=]

在 Windows 批处理文件中,您可以使用关键字 ~dp 或在 Python 中使用 __file__... 所以我想知道我是否可以使用一些类似的特殊关键字从 .gitconfig 文件中引用特殊的差异脚本(存在于与回购级别 .gitconfig 相同的回购中)?我在想这样的事情:

**.gitconfig**

[diff "xlsx"]
    binary = true
    textconv = python $REPO_ROOT_OF_THIS_GIT_CONFIG/src/util/git-xlsx-textconv.py

我的目录结构如下所示:

REPO_ROOT
    .gitconfig
    .gitignore
    .gitattributes
    README.txt
    Requirements.txt
    src
        main.py
        util
            git-xlsx-textconv.py

适用于 ConEmucmd.exegit-bash(我假设 Linux):

textconv = python `git rev-parse --show-toplevel`/src/util/git-xlsx-textconv.py