dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
21.43k stars 361 forks source link

๐Ÿ› doesn't work on `git am -i`'s `[v]iew patch` #1547

Open JonatasAmaral opened 9 months ago

JonatasAmaral commented 9 months ago

I have delta correctly setup as my git's pager, with interactive options and do on

When running git am -i ..., and in the interactive session choosing [v]iew patch, the current .patch diff should be displayed. But with delta enabled, that "wrong usage" error shows up instead:

The main way to use delta is to configure it as the pager for git: see https://github.com/dandavison/delta#get-started. You can also use delta to diff two files: delta file_A file_B.

I only can suppose git does a delta ./file.patch (like a with --no-pager option, the result is the same as simple cat ./file.patch), which indeed trigger that error message. I can see that piping the file do delta works pretty well, as it just ignores the patch header, and show the diff properly:

> cat ./file.patch

file.patch 
From ...

---
.file.txt | 1+
1 file changed ...

diff --git a/file.txt b/file.txt
...
@@ -1,2 +1,3 @@
text file
+ a change
> cat ./file.patch | delta

file.patch 
From ...

---
.file.txt | 1+
1 file changed ...

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
ฮ” file.txt
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ€ข file.txt:1: โ”‚
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1 โ‹ฎ  1 โ”‚text file
    โ‹ฎ  2 โ”‚a change

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Running manually without the pager (git --no-pager am -i ...), and if needed to see long diffs, do a delta pipe on other terminal, is a somewhat inconvenient workaround, but works for now.

So i suppose it is kinda a feature-request too, to enable delta to read a single .patch file delta file.patch, if it is indeed the workflow going on under the hood here.