Re: [PATCH v3 4/4] add-patch: render hunks through the pager
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 17, 2024, 20:09 UTC
- Message-ID
- <CAPig+cRyj8J7MZEufu34NUzwOL2n=w35nT1Ug7FGRwMC0=Qpwg@mail.gmail.com>
- In-Reply-To
- <xmqqfrs723bp.fsf@gitster.g>
On Wed, Jul 17, 2024 at 4:04 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> phillip.wood123@gmail.com writes: > >> - test_write_lines P q | GIT_PAGER="head -n 1" test_terminal git add -p > >> + test_write_lines P q | > >> + ( > >> + GIT_PAGER="head -n 1" && > >> + export GIT_PAGER && > >> + test_terminal git add -p >actual > >> + ) > > > > That's surprising, why does running git in a sub-shell stop it from > > segfaulting? > > Yeah, it indeed is curious. > > The rewrite resolves another iffy point in the original---you are > not supposed to attempt a one-shot assignment to the environment > variable when you are running a shell function, as that is not > portable. And the above rewrite is a common way to fix that.
It's also curious that t/check-non-portable-shell.pl didn't catch this use of one-shot assignment when calling a shell function[*].
[*] a0a630192d (t/check-non-portable-shell: detect "FOO=bar shell_func", 2018-07-13)