Re: [PATCH 2/2] add--interactive.perl: specify --no-color explicitly
From: Junio C Hamano <hidden>
Date: 2020-09-08 16:55:05
Jeff King [off-list ref] writes:
By the way, this is an instance of a more generic bug, which is that: git -p my-script will cause any sub-programs of git-my-script to think their stdout is going to a pager, even if my-script redirects them to a file or another pipe. I had a solution long ago in: https://lore.kernel.org/git/20150810052353.GB15441@sigill.intra.peff.net/ (local) but it raises a bunch of interesting portability questions. Since this comes up so rarely, I never really pursued it further.
That indeed is from long ago ;-) and I still kind of like it. Is the issue that some platforms do not even have inum of the "thing" connected to a file descriptor? I think a fallback code for such a system can just return a constant pipe ID to anybody asks, so that an exported GIT_PAGER_PIPE_ID would always match, which gives the behaviour identical to what we currently do with GIT_PAGER_IN_USE, and that would be one way to help those capable of giving useful IDs while not harming others. Thanks.