Hi Jeff, I think I finally get it now. Thank you for so patiently explaining this to me in different ways. I'm sorry I was slow to understand heh. Just to be really clear, the filter in `interactive.diffFilter` is meant as a filter for transforming (think a photo filter), as opposed to a filter that removes elements, correct? I think that's what I got tripped up on when you explained the first two times. On Wed, Aug 16, 2023 at 10:44 PM Jeff King <peff@xxxxxxxx> wrote: > > On Wed, Aug 16, 2023 at 09:30:38AM -0700, Patrick wrote: > > > Jeff, would you be so kind as to elaborate more on the > > interactive.diffFilter approach? My understanding is that > > interactive.diffFilter is only used for git add -p or git reset -p. > > However, the limitation for my use case is I need to use the pager > > for git log and git show so that won't work. So then, you are > > suggesting that I ask my users to opt in by setting an arbitrary git > > config like fzf.pager and then read out the pager from that git var? > > Yes, they'd have to set a new config variable. Though if you are really > just filtering diffs and the semantics would be the same as > interactive.diffFilter, I would probably just use that. You could also > introduce a new foo.diffFilter option, and if unset have it default to > the value of interactive.diffFilter. That provides flexibility without > forcing users to repeat themselves. > > That said, I would not be surprised if many users who set pager.log do > not even know about interactive.diffFilter. It's a bit more obscure, and > came later. > > If you do want to follow that approach, the simplest example is probably > just to see how it was added to the perl code in 01143847db > (add--interactive: allow custom diff highlighting programs, 2016-02-27): > > https://github.com/git/git/commit/01143847dbf4fbf27268650f3ace16eac03b3130 > > In shell it might look something like: > > filter=$(git config --get interactive.difffilter) > if test -n "$filter"; then > git show ... | eval "$filter" > else > git show ... > fi > > -Peff