Closed infokiller closed 9 months ago
Hi @infokiller, nice to hear from you. I view it as desired behavior, not a bug, that git does not use delta when output is going to a pipe: IMO delta's output is for humans to read, not for machines to parse, so there are few scenarios when one wants delta's output to go to a pipe/file. Do you have such a scenario?
As you say, the way this (IMO desired) behavior is achieved is that git itself doesn't invoke its pager when output is not a tty (because the git authors view the pager output as for human eyes, not machines). That means also that there's a simple solution for the cases when one does want delta's output to go to a pipe: pipe it into delta explicitly:
git diff | delta | head
So I'm definitely happy to hear ideas about GIT_EXTERNAL_DIFF
, but I'm going to close this since I don't think delta should change anything regarding this behavior. But do feel free to reopen.
That said there is something fairly esoteric in one of the end-to-end tests that does what you're asking for I think!
Hi @dandavison great to talk to you again and thanks for the quick response! My use case was using it for fzf previews. Indeed, both of your suggestions work fine for this use case, thanks!
Hi,
I noticed that git uses its internal diff formatting instead of delta when piping its output, for example the following command doesn't show output from delta:
I suspect this is related to https://github.com/dandavison/delta/issues/799#issuecomment-1077865831, i.e. using delta via
GIT_EXTERNAL_DIFF
ordiff.external
in the config would solve it. However, that requires delta to support being invoked with the argspath old-file old-hex old-mode new-file new-hex new-mode
.