Open SemihGk opened 5 years ago
Please check your .gitconfig
.
This might help:
[mergetool "meld"]
trustExitCode = true
cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"
I'm seeing the same issue on a simple git difftool
command. I'm currently running macOS 10.14.1 Mojave. Before upgrading to Mojave, I had been successfully using this .gitconfig file:
[diff]
tool = meld
[difftool]
prompt = false
[difftool "meld"]
trustExitCode = true
cmd = open -W -a Meld --args \"$LOCAL\" \"$REMOTE\"
Using the latest build from @yousseb , I ran 'git difftool test.txt` on a simple repository. Meld opens with a file on the left and an error on the right, as shown here:
There was a problem opening the file “/test.txt”.
Error opening file /test.txt: No such file or directory
Running ps
shows that the following command is running:
/Applications/Meld.app/Contents/MacOS/Meld-bin /var/folders/d_/hrd5rw9j3j90q4bxmyvzx4p80000gn/T//awpnka_test.txt test.txt
Then I prepended $PWD/
to $LOCAL
and $REMOTE
as suggested by @mitu-lv and then re-reran the same command again. This time when Meld opens, there is an error on the left and a file on the right.
There was a problem opening the file “/Users/knumat/Documents/test/var/folders/d_/hrd5rw9j3j90q4bxmyvzx4p80000gn/T/C2Gc7a_test.txt”.
Error opening file /Users/knumat/Documents/test/var/folders/d_/hrd5rw9j3j90q4bxmyvzx4p80000gn/T/C2Gc7a_test.txt: No such file or directory
Running ps
shows that the following process is running:
/Applications/Meld.app/Contents/MacOS/Meld-bin /Users/knumat/Documents/test//var/folders/d_/hrd5rw9j3j90q4bxmyvzx4p80000gn/T//C2Gc7a_test.txt /Users/knumat/Documents/test/test.txt
As best I can tell, it looks like this build of Meld must be prepending /
to the beginning of the filename. This works fine for absolute paths, but does not work for relative paths. Prepending $PWD/
is a fine workaround if you only want to deal with relative paths, but doesn't work if dealing with absolute paths. I'm assuming that is why it was removed from the documentation:
https://github.com/yousseb/meld/commit/06e9314009a87ab319c6544ccc6b6edc63384bb9
@mitu-lv Thank you for your suggestion. I just tested your suggestion and it works like a charm. I appreciated. As @knumat mentioned above, this suggestion should be updated in the documentation as well.
As of this build https://github.com/yousseb/meld/releases/tag/osx-13
meld should act exactly as it would in Linux. No wrapper script involved anymore. Please verify and let me know.
@yousseb Thanks for the updated build! Meld successfully starts without a wrapper script, so that's great news. Running ps
now shows the following:
/Applications/Meld.app/Contents/MacOS/Meld /var/folders/d_/hrd5rw9j3j90q4bxmyvzx4p80000gn/T//awpnka_test.txt test.txt
However, something inside Meld still seems to be prepended a slash at the beginning of relative filenames when I run git difftool text.txt
(see my previous comment). Specifically, I'm still getting the following error:
There was a problem opening the file “/test.txt”.
Error opening file /test.txt: No such file or directory
Notes:
I finally got Meld working with local paths with the following .gitconfig
file that runs Meld
directly instead of using open
:
[diff]
tool = meld
[difftool]
prompt = false
[difftool "meld"]
trustExitCode = true
#cmd = open -W -a Meld --args \"$LOCAL\" \"$REMOTE\"
cmd = /Applications/Meld.app/Contents/MacOS/Meld \"$LOCAL\" \"$REMOTE\"
I'm not sure why running Meld
directly is different than using open
, since the Meld command line arguments appear to be the same when I run ps
. Maybe there are some differences in environment variables? Or perhaps macOS sanitizes the ps output for security reasons? Can anyone else shed some light on this subject?
Please check your
.gitconfig
. This might help:[mergetool "meld"] trustExitCode = true cmd = open -W -a Meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"
Very nice. This worked for me and I was facing the same issue as @SemihGk
I was able to open the conflicting files by prepending $PWD in the path, but while trying to save the edits, it throws an error:
Couldn't save file due to: g-io-error-quark: Error opening file "/test": Permission denied (14)
It's somehow prepending path with a "/" which might be causing the problem. The command-line for Meld shows:
/Applications/Meld.app/Contents/MacOS/Meld --auto-merge /private/tmp/git_test/v1/./test_LOCAL_70233 /private/tmp/git_test/v1/./test_BASE_70233 /private/tmp/git_test/v1/./test_REMOTE_70233 --output=test
I had the same problem - looks like sometimes you get relative paths and sometimes absolute. This is what I ended up with:
[difftool "meld"]
# if REMOTE or LOCAL starts with /, use it as is, if not, prepend $PWD
cmd = open -W -a Meld --args \"$([[ "$LOCAL" == /* ]] && echo "$LOCAL" || echo "$PWD/$LOCAL")\" \"$([[ "$REMOTE" == /* ]] && echo "$REMOTE" || echo "$PWD/$REMOTE")\"
Regarding this issue #70 , @yousseb released a nightly build for the Mohave compatibility issue. I tested the build. However, the new build is unable to open conflicted files.
There was a problem opening the file “somepath/somefile_LOCAL.java”.
There was a problem opening the file “somepath/somefile_BASE.java”.
There was a problem opening the file “somepath/somefile_REMOTE.java”.
I checked the files and they exist. Somehow, Mojave cannot open the files. Here is my .gitconfig
Another note that the project is an Anroid repo and is quite large. I smell an async issue. Maybe, when Meld tries to open the files, they might not be created at that time. It is just a guess though.
This issue is only problem at the mojave build. If I run stable build, there is no this kind of path issue despite the fact that I need to run clean meld settings script each time.