sublime-text-git icon indicating copy to clipboard operation
sublime-text-git copied to clipboard

External difftool issue with this package

Open ipaintcode opened this issue 12 years ago • 5 comments

With my limited knowledge I've been trying to get this package to work with Kaleidoscope 2 for a few days. This is the error I get:

"/usr/local/git/libexec/git-core/git-mergetool--lib: line 119: ksdiff: command not found"

This is what Kaleidoscope injects into the ~/.gitconfig file:

[difftool "Kaleidoscope"] cmd = ksdiff --partial-changeset --relative-path "$MERGED" -- "$LOCAL" "$REMOTE" [diff] tool = Kaleidoscope [difftool] prompt = false [mergetool "Kaleidoscope"] cmd = ksdiff --merge --output "$MERGED" --base "$BASE" -- "$LOCAL" --snapshot "$REMOTE" --snapshot trustExitCode = true [mergetool] prompt = false [merge] tool = Kaleidoscope

Now if I change the cmd = ksdiff to cmd = path/to/ksdiff, this git package will fire correctly but then the cmd = path/to/ksdiff reverts back to cmd = ksdiff (I'm assuming Kaleidoscope is doing that). I've tried making some tweaks in the sublime packages but no dice.

Any suggestions?

ipaintcode avatar Jan 07 '13 12:01 ipaintcode

This is an issue with ST2 not loading $PATH correctly.

I'm not familiar enough with ST2 to be sure why, but the default path from os.environ (which is what informs ST2s ability to find a given executable) is

/usr/bin:/bin:/usr/sbin:/sbin

so a simple fix (while probably not ideal) is to link /usr/local/bin/ksdiff to /usr/bin

sudo ln -s /usr/local/bin/ksdiff /usr/bin/ksdiff

rustle avatar Jan 09 '13 02:01 rustle

After some research I figured out what the issue is:

pythons subprocess.popen called from inside an application on OS X as of 10.8 has it's environment set by

/etc/launchd.conf and in theory ~/.launchd.conf

In testing, ~/.launchd.conf didn't seem to effect the environment for subprocess.popen

To make the environment be able to find things in /usr/local/bin edit /etc/launchd.conf (you may need to create it and you'll need to be an admin do anything in /etc) to add

setenv PATH /bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Be very judicious about editing this PATH variable (and this file in general), you can cause yourself a lot of hassle if you put in a bad value.

After you've finished editing, restart your machine and git diff tool should work fine.

rustle avatar Jan 09 '13 03:01 rustle

Any ideas on getting this to work on Windows?

Givemeyourgits avatar Apr 25 '13 08:04 Givemeyourgits

Hi,

I have the same problem with Sublimerge. /Library/Developer/CommandLineTools/usr/libexec/git-core/git-mergetool--lib: line 124: subl: command not found fatal: external diff died, stopping at <myfile>

Here is what I have in .gitconfig:

[merge] tool = sublimerge

[mergetool] prompt = false

[mergetool "sublimerge"] cmd = subl -n --wait "$LOCAL" "$MERGED" "$REMOTE" "$BASE" --command "sublimerge_diff_views" trustExitCode = false

[diff] tool = sublimerge

[difftool] prompt = false

[difftool "sublimerge"] cmd = subl -n --wait "$LOCAL" "$REMOTE" --command "sublimerge_diff_views {\"left_read_only\": true, \"right_read_only\": false}"

The command subl is in $HOME/bin and links to ST3. I cannot create a symlink in /usr/bin as it is now protected in OSX Sierra (by System Integrity Protection). I tried to create the /etc/launchd.conf and set the PATH there but it did not have any effect even after restart.

The last thread was more than 3 years ago, maybe there changed something.

divenyijanos avatar Jan 25 '17 15:01 divenyijanos

The problem was that Sublime itself did not see my $PATH.

Here is how to fix this issue: https://forum.sublimetext.com/t/how-to-set-path-on-os-x-so-sublime-can-see-it/11842

divenyijanos avatar Jan 25 '17 15:01 divenyijanos