pkryger / difftastic.el

Wrapper for difftastic
GNU General Public License v3.0
45 stars 4 forks source link

difftastic-magit-show results in several errors: no such file and external diff died. #10

Closed drewverlee closed 1 month ago

drewverlee commented 1 month ago

in this picture, you can see me calling difftastic-magit-show on the git commit.

image

I hope to get a diffstastic view of the changes from the last commit. Instead i get:

image

What more information can i provide?

pkryger commented 1 month ago

Hello @drewverlee! Thanks for the report. I think the actions you take should produce desired outcome, i.e., show you changes from last commit.

From the screenshots I suspect that something's off with the git process (that runs difft) that is supposed to create an actual diff. You can see that git has produced a nice header with commit hash, author, date, and comment. However the difft portion has died for some reason.

To verify that assumption, could you please make sure you have the most recent difftastic installed (difft --version, ATM it's 0.59.0) and then run the following command in your terminal::

GIT_EXTERNAL_DIFF=difft git show --ext-diff c487a59
drewverlee commented 1 month ago
> ➜  foobar git:(master) ✗ GIT_EXTERNAL_DIFF=difft git show --ext-diff c487a59 

results in

 commit c487a59a8141ff39d9c622e39a5bfc898840a2a2 (HEAD -> master)
Author: drew verlee <drew.verlee@gmail.com>
Date:   Wed Jul 24 20:53:10 2024 -0500

    if branch

No such file: /tmp/SZENFW_core.clj
No such file: /tmp/6er0EW_core.clj
fatal: external diff died, stopping at src/foobar/core.clj

here is the version:

➜  foobar git:(master) ✗ difft --version
Difftastic 0.59.0 (ffe27c575 2024-07-20, built with rustc 1.65.0)

I built it using ubuntu snaps and then aliased difftastic to difft

pkryger commented 1 month ago

I interpret this results as an indicator of an issue with difftastic itself. Unfortunately, I have no capacity to debug it further. Perhaps you can rise an issue in the upstream?

drewverlee commented 1 month ago

It's not an upstream issue with difftastic because after I reinstalled difftastic using linuxbrew (as opposed to snap) I can trigger difftastic from the command line:

GIT_EXTERNAL_DIFF=difft git show --ext-diff c487a59  

And get the desired result:

image

However still no luck from emacs. It can't find the program difft. the relevnet bit of the errort below is "difft: not found"

commit c487a59a8141ff39d9c622e39a5bfc898840a2a2 (HEAD -> master)
Author: drew verlee <drew.verlee@gmail.com>
Date:   Wed Jul 24 20:53:10 2024 -0500

    if branch

difft --color always --width 144 --background dark: 1: difft: not found
fatal: external diff died, stopping at src/foobar/core.clj

However, if I use the emacs project shell, it can find it:

image

Where is the package looking for difft? ill look into this further.

I set a zsh.rc alias like so:

  alias difftastic="difft"

my first thought is maybe i need to emacs the same thing? Unlikely, the package docs say it looks for the cli difft, which exists.

.... Success! The issue at the very end here was that i started emacs from an old shell. session that couldn't find the newly installed difft. I'm surprised that the emacs function 'project shell' could find it, but I guess that starts a new shell.

drewverlee commented 1 month ago

If there is anything to improve here, it's unclear to me. I think i made a ~/tmp directory at one point and then the error message more clearly showed the issue was it couldn't find difft on the cli, and which point is was more clear to me what I had to do.

ill leave this open, but feel free to close it if it's no longer useful.

pkryger commented 1 month ago

Thank you for reporting back. And glad you solved the issue. FWIW, the package uses difftastic-executable variable to locate the difftastic executable. It defaults to difft. Not sure why Emacs started in the old session was not able to locate the new executable. But seems to work now. Closing.