Re: [PATCH 2/2] add--interactive.perl: specify --no-color explicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 07, 2020 at 04:17:39AM -0400, Jeff King wrote:

> Our color tests of "git add -p" do something a bit different from how a
> normal user would behave: we pretend there's a pager in use, so that Git
> thinks it's OK to write color to a non-tty stdout.  This comes from
> 8539b46534 (t3701: avoid depending on the TTY prerequisite, 2019-12-06),
> which allows us to avoid a lot of complicated mock-tty code.
> 
> However, those environment variables also make their way down to
> sub-processes of add--interactive, including the "diff-files" we run to
> generate the patches. As a result, it thinks it should output color,
> too. So in t3701.50, for example, the machine-readable version of the
> diff we get unexpectedly has color in it. We fail to parse it as a diff
> and think there are zero hunks.

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@xxxxxxxxxxxxxxxxxxxxx/

but it raises a bunch of interesting portability questions. Since this
comes up so rarely, I never really pursued it further.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux