2

After reading through Configuring diff tool with .gitconfig, I setup my ~/.gitconfig to contain the following:

[diff]
    tool = bbdiff
[difftool "bbdiff"]
    cmd = /usr/local/bin/bbdiff --wait --resume "$LOCAL" "$REMOTE"

But when I run git difftool or git difftool somefile.ext, I just get the diff dumped to stdout (in color). How do I figure out why bbdiff isn't being invoked?

Note I'm using macOS 10.15.6 with its default zsh and git version 2.28.0.

Update: (with answers to questions in the comments)

responding to zrzka's second comment:

✗ git config -l | fgrep diff
diff.tool=bbdiff
difftool.bbdiff.cmd=/usr/local/bin/bbdiff --wait --resume $LOCAL $REMOTE

responding to zrzka's third comment:

✗ git difftool --tool-help
'git difftool --tool=<tool>' may be set to one of the following:
        opendiff
        vimdiff
        vimdiff2
        vimdiff3

    user-defined:
        bbdiff.cmd /usr/local/bin/bbdiff --wait --resume $LOCAL $REMOTE

The following tools are valid, but not currently available:
        araxis
        ...

Update #2:

Just in case it's related, I don't know why all git commands I run in iTerm (or Terminal) are piped through less. git branch and git diff both stop after one page and h brings up "SUMMARY OF LESS COMMANDS". But git difftool is not piped through less.

Update #3:

As suggested by zrzka's comment, I created /usr/local/bin/foo:

✗ cat /usr/local/bin/foo
#!/usr/bin/env bash
echo "Foo $@"
✗ ll /usr/local/bin/foo
-rwxr-xr-x  1 dspitzer  admin    34B Aug 13 13:09 /usr/local/bin/foo

And I configured it in my .gitconfig:

✗ cat ~/.gitconfig
[user]
    name = Daryl Spitzer
    email = dspitzer@xxx.xxx
[pager]
    diff = false
[diff]
    tool = foo
[difftool]
    prompt = false
[difftool "foo"]
    cmd = /usr/local/bin/foo "$LOCAL" "$REMOTE"

But git difftool just outputs to stdout.

Q: Does git have a log somewhere?

Daryl Spitzer
  • 121,723
  • 75
  • 151
  • 166
  • 1
    What happens when you launch `bbdiff` manualy? Does it work? I just tested difftool configuration with a dummy script and [it works](https://cln.sh/CG8X12) as expected (Big Sur machine & different git version). – zrzka Aug 13 '20 at 17:54
  • I used `git show` to copy the previous version of somefile.ext to a temporary file, and then ran `/usr/local/bin/bbdiff --wait --resume somefile.ext ~/temp/somefile.ext` and it worked. But `git difftool somefile.ext` still doesn't. – Daryl Spitzer Aug 13 '20 at 18:36
  • 1
    Just tried with the file as an argument and [it works](https://cln.sh/OCrdpG) too. What does [`git config -l | grep`](https://cln.sh/UR46nL) says? Asking, because there can be an invisible character (or whatever) which disallows `git` to parse the config properly? (wild guess) – zrzka Aug 13 '20 at 18:46
  • 1
    Or one can verify it with the [`git difftool --tool-help`](https://cln.sh/imzUlw). If the configuration is fine then it should be listed there. – zrzka Aug 13 '20 at 18:52
  • Another test with `bbdiff` (same settings as yours) - [works](https://cln.sh/7ldySj). But I had to approve couple of things on Big Sur (Privacy - Automation - iTerm.app can control BBEdit.app). Couple of other ideas ... 1) What happens when you configure dummy [`foo` script](https://cln.sh/CG8X12), does it work? 2) What happens when you run it with `-t bbdiff`? 3) Does `--no-gui` helps? It might fallback to `merge.guitool` w/o it. Running out of ideas :) – zrzka Aug 13 '20 at 19:44
  • I appreciate your continued comments zrzka. But your suggestions in your last comment aren't clear to me. Can you be more specific in the commands you're suggesting in 1, 2, & 3? – Daryl Spitzer Aug 13 '20 at 19:48
  • 1
    1) Try to configure some dummy script like I did with the `foo` ([screenshot](https://cln.sh/CG8X12)), just to avoid `bbdiff` completely while testing 2) You can force a specific tool via `git difftool -t bbdiff` 3) Just try `git difftool --no-gui` | Re `less` - it's a default pager, you can turn it off via `pager.diff = false`, etc. – zrzka Aug 13 '20 at 19:59
  • 2) `git difftool -t bbdiff` is no different from `git difftool`--the output is to stdout (without less). 3) `git difftool --no-gui` is no different either ... Stay tuned for #1 – Daryl Spitzer Aug 13 '20 at 20:06

0 Answers0