Skip to content
  • Jonathan Nieder's avatar
    Make 'git var GIT_PAGER' always print the configured pager · 64778d24
    Jonathan Nieder authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Scripted commands that want to use git’s configured pager know better
    than ‘git var’ does whether stdout is going to be a tty at the
    appropriate time.  Checking isatty(1) as git_pager() does now won’t
    cut it, since the output of git var itself is almost never a terminal.
    The symptom is that when used by humans, ‘git var GIT_PAGER’ behaves
    as it should, but when used by scripts, it always returns ‘cat’!
    
    So avoid tricks with isatty() and just always print the configured
    pager.
    
    This does not fix the callers to check isatty(1) themselves yet.
    Nevertheless, this patch alone is enough to fix 'am --interactive'.
    
    Thanks to Sebastian Celis for the report and Jeff King for the
    analysis.
    
    Reported-by: default avatarSebastian Celis <sebastian@sebastiancelis.com>
    Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    64778d24