TLDR;新的错误消息“ This message is displayed because 'diff.tool' is not configured.
”可能是实际的错误修复,而不是新错误。
我只是尝试过......没有收到任何错误消息(不带参数使用时)。
vonc@vonvb:~/git/cplgit/linux$ ./set_git 2.22.0
git set to v2.22.0
vonc@vonvb:~/git/cplgit/linux$ git version
git version 2.22.0
vonc@vonvb:~/git/cplgit/linux$ git config -l|grep -i tool
vonc@vonvb:~/git/cplgit/linux$ git difftool
此外,此错误消息已在2013 年 1 月的 Git v1.8.2-rc0 提交 5338a6a 中引入。
我确实提到了 Git 2.22 中的提交 05fb872,它使用${GIT_MERGETOOL_GUI}
.
我的机器上没有设置该环境变量,我没有收到任何错误消息。
检查您自己的git config
和环境变量。
我确实在 Git 2.22 中看到了错误消息:
vonc@vonvb:~/gits/src/git$ git difftool --no-index color.c color.h
This message is displayed because 'diff.tool' is not configured.
See 'git difftool --tool-help' or 'git help config' for more details.
'git difftool' will now attempt to use one of the following tools:
meld opendiff kdiff3 tkdiff xxdiff kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare smerge emerge vimdiff
Viewing (1/1): 'color.c'
Launch 'bc' [Y/n]?
The diff tool bc is not available as 'bcompare'
fatal: external diff died, stopping at color.c
使用 Git 2.21.0,它默认为常规git diff
:
vonc@vonvb:~/git/cplgit/linux$ ./set_git 2.21.0
git set to v2.21.0
vonc@vonvb:~/git/cplgit/linux$ git version
git version 2.21.0
vonc@vonvb:~/git/cplgit/linux$ cdgg
vonc@vonvb:~/gits/src/git$ git difftool --no-index color.c color.h
diff --git a/color.c b/color.h
index ebb222ec33..98894d6a17 100644
从OP Git 邮件列表线程:
Denton Liu指出了Jeff King ( )的原始提交 287ab28(2019 年 2 月 16 日。(由Junio C Hamano 合并 -- --在提交 12e5bdd中,2019 年 3 月 7 日)peff
gitster
diff
--no-index
:为案例重用差异设置
当“ --no-index
”生效(或参数暗示)时,git-diff
提前跳转到特殊代码路径以执行该差异。
这意味着我们错过了一些设置,例如启用--ext-diff
和--textconv
默认设置。
杰夫金 回复:
我不太了解它是如何git-difftool
工作的,但看起来它设置了GIT_EXTERNAL_DIFF=git-difftool--helper
.
在287ab28bfa之前,我们在运行时不会尊重任何外部 diff 命令git-diff
。但在它之后,我们做到了。
如果用户没有提供--no-index
,那么这一切都像我猜difftool
的那样工作:它运行帮助程序并说“嘿,你没有配置这个”。
似乎上述命令在287ab28bfa之前的行为不是故意的。
它会运行git-diff
,期望它触发助手,但它从来没有这样做(而是只是做了一个 normal no-index diff
)。
所以看起来新行为实际上是正确的,因为它使--no-index
案例与常规行为一致?
我完全不清楚为什么你会在difftool
这里运行“”,如果你没有配置它并且你只想要直接diff
输出。