Use Komodo with external git diff tool

Aaahh now I remember why I disabled it (git extension) a few months ago… every time I make a small edit, Komodo opens a diff window :cry:
Is there a way to disable such behaviour?

When it opens a diff window? It could be an userscript, try to restart with tools disabled. (Help - troubleshooting)

As soon as I hit “save” with a modify, it opens my external diff tool. If I edit back and save to the original state (e.g. the file is not “not staged for commit”), the diff is not opening.
I also tried to restart without tools, it’s the same.

You have a custom diff tool configured for git, either remove this configuration or configure your Komodo environment to use a different git config.

1 Like

Thank you @nathanr
Can you point me to a documentation to configure my Komodo environment to use a different git config?

We don’t have documentation on that, it is a very specific use-case, we cannot cover every possible use-case in our docs :frowning:

I don’t know what the exact steps would be, it depends on how git configures itself in this regard. Likely you can set an environment variable to override the diff tool or to override your git config path.

Check out:

https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

In particular the following 2 ENV vars seem to be of interest:

  • GIT_DIFF_OPTS is a bit of a misnomer. The only valid values are -u or --unified=, which controls the number of context lines shown in a git diff command.
  • GIT_EXTERNAL_DIFF is used as an override for the diff.external configuration value. If it’s set, Git will invoke this program when git diff is invoked.

You can set these in Komodo under Preferences > Environment.

Well, I’d like to keep my external diff tool to use outside Komodo, but also getting Komodo working with default git diff.
Unfortunately, I can’t find a way to set a value for GIT_EXTERNAL_DIFF that is restoring the default git diff, so I don’t know what to put inside Komodo environment variables.

What does your git config look like?

[color]
    ui = true
[user]
    name = Massimiliano Arione
    email = garakkio@gmail.com
[diff]
    external = git-meld
[core]
    excludesfile = ~/.gitignore
    attributesfile = ~/.gitattributes
[push]
    default = simple
[diff "image"]
    command = /usr/local/bin/imgdiff.sh

Have you tried setting

GIT_EXTERNAL_DIFF = diff

In Komodo’s Pref > Environment ?

OK, I ended up solving by creating following script:

#!/bin/bash
diff "$2" "$5"

exit 0

put such script in /usr/local/bin/git-diff-komodo.sh and set GIT_EXTERNAL_DIFF = git-diff-komodo.sh

Thanks for the help @nathanr

That’s odd that you needed that, I would think GIT_EXTERNAL_DIFF = diff would effectively achieve the same thing. Anyway, thanks for the update!