• Junio C Hamano's avatar
    pager: do not leak "GIT_PAGER_IN_USE" to the pager · 124b5190
    Junio C Hamano authored
    Since 2e6c012e (setup_pager: set GIT_PAGER_IN_USE, 2011-08-17), we
    export GIT_PAGER_IN_USE so that a process that becomes the upstream
    of the spawned pager can still tell that we have spawned the pager
    and decide to do colored output even when its output no longer goes
    to a terminal (i.e. isatty(1)).
    But we forgot to clear it from the enviornment of the spawned pager.
    This is not a problem in a sane world, but if you have a handful of
    thousands Git users in your organization, somebody is bound to do
    strange things, e.g. typing "!<ENTER>" instead of 'q' to get control
    back from $LESS.  GIT_PAGER_IN_USE is still set in that subshell
    spawned by "less", and all sorts of interesting things starts
    happening, e.g. "git diff | cat" starts coloring its output.
    We can clear the environment variable in the half of the fork that
    runs the pager to avoid the confusion.
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    Acked-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
pager.c 3.35 KB