通过 git difftool 进行 WinMerge 不断提示输入第二个文件
我使用了 @VonC 的 优秀说明 配置我的开发系统,以便 git difftool
将以下内容放入
~/.gitconfig
:[差异]
<前><代码>工具 = winmerge[difftool“winmerge”]
cmd = winmerge.sh \"$LOCAL\" \"$REMOTE\"
[差异工具]
提示= false
创建了
/usr/bin/winmerge .sh
包含以下内容:echo 启动 WinMergeU.exe:$1 $2
"C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -ub "$1" "$2"
现在,当我尝试通过 git difftool
Launching WinMergeU.exe: /tmp/21qMVb_file1.c /tmp/1ACqik_file1.c
但是,由于某些奇怪的原因, WinMerge 不是并排显示两个文件,而是提示输入第一个 文件作为右侧,并接受第二个文件作为左侧:
为什么会发生这种情况?我在配置步骤中错过了什么?
PS 当我在命令行中输入 winmerge.sh file1.c file2.c
时,WinMerge 立即并排显示这两个文件,正如我所期望的那样。
更新:哦,哇,我刚刚注意到 WinMerge 提示底部的两个路径都无效
消息(并更新了屏幕截图以强调这一点)。看来这些文件根本不是由 difftool 生成的,或者路径有问题。
I used @VonC's excellent instructions to configure my development system so that git difftool <BRANCH1> <BRANCH1>
will invoke WinMerge. Here is what I did:
Placed the following in
~/.gitconfig
:[diff]
tool = winmerge
[difftool "winmerge"]
cmd = winmerge.sh \"$LOCAL\" \"$REMOTE\"
[difftool]
prompt = false
Created a
/usr/bin/winmerge.sh
with the following content:echo Launching WinMergeU.exe: $1 $2
"C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -ub "$1" "$2"
Now, when I try to launch WinMerge via git difftool <BRANCH1> <BRANCH1>
, I receive what seems to be correct parameter passing:
Launching WinMergeU.exe: /tmp/21qMVb_file1.c /tmp/1ACqik_file1.c
But, for some strange reason, instead of WinMerge displaying the two files side-by-side, it prompts for entering the first file as the right-side, with the second file accepted as the left-side:
Why is this happening? What did I miss in the configuration steps?
P.S. When I type on the command line winmerge.sh file1.c file2.c
, WinMerge immediately displays the two files side-by-side, just as I would expect.
UPDATE: Oh wow, I just noticed the Both paths are invalid
message at the bottom of WinMerge's prompt (and updated the screenshot to emphasize that). It appears that these files simply weren't generated by difftool or something is wrong with the path.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了问题!
解决方案在于@pydave的 在同一线程中回答。我所要做的就是用
cygpath -w $1
cygpath -w $2
替换"$1" "$2"
(在 winmerge.sh 中)。现在效果很好。正如我所期望的那样。
I solved the problem!
The solution lies in the hint provided by @pydave's answer in the same thread. All I had to do is replace
"$1" "$2"
(in winmerge.sh) withcygpath -w $1
cygpath -w $2
.It works beautifully now. Just as I would expect.