yousseb / meld

Meld for macOS
https://yousseb.github.io/meld/
GNU General Public License v2.0
2.27k stars 120 forks source link

Website has wrong .gitconfig example #123

Open szgergo opened 3 years ago

szgergo commented 3 years ago

On the website: https://yousseb.github.io/meld/ we have this .gitconfig example:

[diff]
  tool = meld
[difftool]
  prompt = false
[difftool "meld"]
  trustExitCode = true
  cmd = open -W -a Meld --args \"$LOCAL\" \"$REMOTE\"
[merge]
  tool = meld
[mergetool]
  prompt = false
[mergetool "meld"]
  trustExitCode = true
  cmd = open -W -a Meld --args --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output=\"$MERGED\"

But this will lead to "Can' open files" error once hit the git merge tool. You need to add $PWD/ in front of all LOCAL,BASE,REMOTE and MERGED variables.

This one works:

[diff]
  tool = meld

[difftool]
  prompt = false

[difftool "meld"]
  trustExitCode = true
  cmd = open -W -a Meld --args \"$PWD/LOCAL\" \"$PWD/$REMOTE\"

[merge]
  tool = meld

[mergetool]
  prompt = false

[mergetool "meld"]
  trustExitCode = true
  cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"
redbilledpanda commented 1 year ago

I second this

sumless commented 3 months ago

In macOS, the open command can be used to open applications, but may not always work as expected, especially when command line arguments are involved. In addition, the open command is usually used to open files rather than passing arguments to the application. So, if we installed meld from Homebrew, we can just use the full path of meld to configure it and it will work fine. Maybe @yousseb should mention this on that page to avoid a lot of newbies running into similar problems!

[diff]
    tool = meld
[difftool]
    prompt = false
[difftool "meld"]
    #trustExitCode = true
    #cmd = open -W -a Meld --args \"$LOCAL\" \"$REMOTE\"
    cmd = /opt/homebrew/bin/meld \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = meld
[mergetool]
    prompt = false
[mergetool "meld"]
    #trustExitCode = true
    #cmd = open -W -a Meld --args --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output=\"$MERGED\"
    cmd = /opt/homebrew/bin/meld --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output=\"$MERGED\"