Git diff 在提供路径时忽略 textconv
Git diff ignores textconv when provided paths
我已经设置了我的 git diff,当它在二进制文件上调用时,它将使用自定义程序作为 textconv,这是在 .gitconfig 文件中指定的。看起来像这样
[diff "file"]
textconv = python "'/path/to/program.py'"
xfuncname = .*name=.*
[core]
attributesfile = ~/.gitattributes
在我的 .git 属性文件中
*.file diff=file
如果应用到我的 git 存储库和终端中,效果很好。然而,我的公司使用 TortoiseGit 作为 git 的前端,它有自己的差异工具,我无法使用 textconv 选项。为了查看差异,我提供了一个像
这样的命令
cmd /K git diff %base %mine
输出将是
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
通常 git 会将 textconv 应用于二进制文件,如果提供 "HEAD" 而不是“%base”,则可以正常工作。我怀疑 git 运行时就好像它是用 --no-index 调用的一样并忽略了 .gitattributes 文件,因此现在不必应用 textconv.
有办法解决这个问题吗?
使用 --textconv
选项强制进行 textconv 转换:
cmd /K git diff --textconv %base %mine
我已经设置了我的 git diff,当它在二进制文件上调用时,它将使用自定义程序作为 textconv,这是在 .gitconfig 文件中指定的。看起来像这样
[diff "file"]
textconv = python "'/path/to/program.py'"
xfuncname = .*name=.*
[core]
attributesfile = ~/.gitattributes
在我的 .git 属性文件中
*.file diff=file
如果应用到我的 git 存储库和终端中,效果很好。然而,我的公司使用 TortoiseGit 作为 git 的前端,它有自己的差异工具,我无法使用 textconv 选项。为了查看差异,我提供了一个像
这样的命令cmd /K git diff %base %mine
输出将是
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
通常 git 会将 textconv 应用于二进制文件,如果提供 "HEAD" 而不是“%base”,则可以正常工作。我怀疑 git 运行时就好像它是用 --no-index 调用的一样并忽略了 .gitattributes 文件,因此现在不必应用 textconv.
有办法解决这个问题吗?
使用 --textconv
选项强制进行 textconv 转换:
cmd /K git diff --textconv %base %mine