通过 git difftool 进行 WinMerge 不断提示输入第二个文件

发布于 2024-11-19 08:10:36 字数 1313 浏览 4 评论 0原文

我使用了 @VonC 的 优秀说明 配置我的开发系统,以便 git difftool将调用 WinMerge。这是我所做的:

  1. 将以下内容放入~/.gitconfig

    [差异]

    <前><代码>工具 = winmerge

    [difftool“winmerge”]

    cmd = winmerge.sh \"$LOCAL\" \"$REMOTE\"
    

    [差异工具]

    提示= false
    
  2. 创建了 /usr/bin/winmerge .sh 包含以下内容:

    echo 启动 WinMergeU.exe:$1 $2

    "C:/Program Files (x86)/WinMerge/WinMergeU.exe" -e -ub "$1" "$2"

现在,当我尝试通过 git difftool启动 WinMerge 时,,我收到了似乎正确的参数传递:

Launching WinMergeU.exe: /tmp/21qMVb_file1.c /tmp/1ACqik_file1.c

但是,由于某些奇怪的原因, WinMerge 不是并排显示两个文件,而是提示输入第一个 文件作为右侧,并接受第二个文件作为左侧:

[WinMerge 应该显示 2 个文件而不是一个

为什么会发生这种情况?我在配置步骤中错过了什么?

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:

  1. Placed the following in ~/.gitconfig:

    [diff]

    tool = winmerge
    

    [difftool "winmerge"]

    cmd = winmerge.sh \"$LOCAL\" \"$REMOTE\"
    

    [difftool]

    prompt = false
    
  2. 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:

[WinMerge should be displaying 2 files not one

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗笺 2024-11-26 08:10:36

我解决了问题!

解决方案在于@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) with cygpath -w $1 cygpath -w $2.

It works beautifully now. Just as I would expect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文