Re: [PATCH] log: if --decorate is not given, default to --decorate=auto
From: Junio C Hamano <hidden>
Date: 2017-03-24 19:13:32
Jeff King [off-list ref] writes:
I see you ended up with a test that uses test_terminal, which is much better (and your patch looks good to me). But I was concerned that there might be a bug in pager_in_use(), so I dug into it a little. I think the code there is correct; it's just relaying the environment variable's value. Likewise, on the setting side, I think the code is correct. We set the environment variable whenever we start the pager in setup_pager(). I think what is confusing is that "git -p" does _not_ mean "unconditionally use a pager". It means "start a pager if stdout is a terminal, even if this command is not usually paged". So something like "git -p log >actual" is correct not to trigger pager_in_use(). I also double-checked the documentation, which covers this case accurately. So I think all is well, and there's nothing to fix. You might want an option for "even though stdout is not a tty pretend like a pager is in use", but that is exactly what GIT_PAGER_IN_USE=1 is for.
Thanks ;-).