yousseb / meld

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

git paths don't work properly when running with 'git diff' #112

Open joshdaniel opened 4 years ago

joshdaniel commented 4 years ago

I've installed this, and it works well for non-git purposes. I've copied the .gitconfig lines, and 'git difftool' now opens Meld. ~/Code/workspace/skymap/api/skymap_api$ git difftool skymap_app/static/skymap_app/index.html

However, in Meld, the repo file on the left looks correct, but the local file on the right is missing, with the error message: "There was a problem opening the file “/api/skymap_api/skymap_app/static/skymap_app/index.html”. Error opening file /api/skymap_api/skymap_app/static/skymap_app/index.html: No such file or directory"

I can manually open the local file on the right by navigating in the Meld file browser and then files are compared correctly, but that's a hassle.

Is this a problem with the way paths to local files are getting passed into Meld (e.g. in terms of relative or absolute paths)? (Or is it possible there's something weird about my git config?)

Thanks!

dsbecker commented 4 years ago

In the past I'd tried a variety of the methods presented, and even suggested some of my own, to get Meld.app to be invoked correctly. What works for me these days is to install the latest Meld via the Homebrew cask and then just tell git to use the command line meld wrapper:

[diff]
  tool = meld
[merge]
  tool = meld
[difftool]
  prompt = false
[mergetool]
  prompt = false
  keepBackup = false
[difftool "meld"]
  cmd = /usr/local/bin/meld "$LOCAL" "$REMOTE"
[mergetool "meld"]
  cmd = /usr/local/bin/meld --auto-merge "$LOCAL" "$BASE" "$REMOTE" --output="$MERGED"
  trustExitCode = true

Although to be fair, I primarily invoke this through Sourcetree (also installed via Homebrew cask) external merge tool feature - so I can't be certain it works through a git command line invocation. But I think that's all Sourcetree calls, so it should.

Hope this helps!

RoyBkker commented 3 years ago

What helped for me was adding the $PWD additions to ./gitconfig:

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