From: Jeff King <firstname.lastname@example.org> To: email@example.com Cc: Tom Hale <firstname.lastname@example.org>, Johannes Schindelin <Johannes.Schindelin@gmx.de> Subject: Re: [PATCH 2/2] add--interactive.perl: specify --no-color explicitly Date: Mon, 7 Sep 2020 04:25:10 -0400 [thread overview] Message-ID: <20200907082510.GA1264377@coredump.intra.peff.net> (raw) In-Reply-To: <20200907081739.GB1263923@coredump.intra.peff.net> 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@sigill.intra.peff.net/ but it raises a bunch of interesting portability questions. Since this comes up so rarely, I never really pursued it further. -Peff
next prev parent reply other threads:[~2020-09-07 8:25 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-07 8:06 [PATCH 0/2] some minor add--interactive fixes Jeff King 2020-09-07 8:08 ` [PATCH 1/2] add-patch: fix inverted return code of repo_read_index() Jeff King 2020-09-07 8:17 ` [PATCH 2/2] add--interactive.perl: specify --no-color explicitly Jeff King 2020-09-07 8:25 ` Jeff King [this message] 2020-09-08 16:25 ` Junio C Hamano 2020-09-08 18:51 ` Johannes Schindelin 2020-09-09 9:15 ` Jeff King
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200907082510.GA1264377@coredump.intra.peff.net \ --email@example.com \ --cc=Johannes.Schindelin@gmx.de \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH 2/2] add--interactive.perl: specify --no-color explicitly' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).