[LRUG] Weird git problem

Andrew Stewart boss at airbladesoftware.com
Fri May 24 03:39:41 PDT 2013


On 24 May 2013, at 11:54, Andrew Stewart <boss at airbladesoftware.com> wrote:
> Sometime in the last few hours git started misbehaving for me across all repos.  For example:
> 
> $ git log                       # works
> $ git log -3                    # nothing shown; exit code 0
> $ git log --since="1 week ago"  # nothing shown; exit code 0
> $ git show HEAD                 # works
> $ git show HEAD~3               # nothing shown; exit code 0
> 
> I'm on git v1.8.2.3 installed via Homebrew on OS X 10.8.3.
> 
> Presumably something changed on my system in the last few hours but I can't think what.  I also can't think how to go about debugging this.

Solved!

For a long time I've had `export LESS='-F -R'` in my bash config.  The -F exits less when there is less than a screenful of content; the -R handles ANSI colour codes.

I recently changed my Terminal.app's terminal declaration from `ansi` to `xterm-256color`.  It seems this new declaration causes less (when used via git) to clear the screen when exiting via -F.  So the solution is to tell git to pass -X to less, which disables the sending of the termcap (de)initialisation strings to the terminal.

In other words adding this to my ~/.gitconfig made everything work:

[core]
  pager = less -FRX

Cheers,
Andy Stewart


More information about the Chat mailing list