tags:

views:

49

answers:

3

I want to reproduce the pager behavior that git-diff uses but I don't know how. Is there a way I could find out what options it uses with less?

I already tried this: strings "$(dirname $(which git-diff))/*" | grep 'less '

And this (while less was running): ps aux | grep less <= Didn't show me which options it was using.

I'm on Darwin.

+2  A: 

A useful technique for doing this sort of thing is to set the GIT_EXTERNAL_DIFF environment variable to a shell script that does nothing but echo its arguments. Then run git diff and look at the output.

Greg Hewgill
good call. Also echo the LESS environment varable from this script in case it's also used
pixelbeat
+2  A: 

See the git-config man page, specifically the description of core.pager. Also, you could inspect the environment of the pager process

$ tr '\0' '\n' < /proc/5568/environ | grep LESS
LESS=FRSX
jamessan
/proc doesn't exist on Darwin but you were right about it being in man git-config.
Ollie Saunders
A: 

See http://www.pixelbeat.org/scripts/idiff for portable ways to control less

pixelbeat