Re: [PATCH] specify encoding for sed command
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2018, 23:17 UTC
- Message-ID
- <xmqqd0z98ezk.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <0102016293c8dca7-6626fcde-548d-476e-b61f-c83ecdeedfe1-000000@eu-west-1.amazonses.com>
Stephon Harris <theonestep4@gmail.com> writes:
Show 15 quoted lines
> Fixes issue with seeing `sed: RE error: illegal byte sequence` when running git-completion.bash > --- > contrib/completion/git-completion.bash | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash > index b09c8a23626b4..52a4ab5e2165a 100644 > --- a/contrib/completion/git-completion.bash > +++ b/contrib/completion/git-completion.bash > @@ -282,7 +282,7 @@ __gitcomp () > > # Clear the variables caching builtins' options when (re-)sourcing > # the completion script. > -unset $(set |sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null > +unset $(set |LANG=C sed -ne 's/^\(__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*\)=.*/\1/p') 2>/dev/null
Shouldn't LC_ALL and LANG both set and exported to C, as
(1) ancient systems understand only LANG but not LC_*; and
(2) modern ones that understand both give precedence to LC_ALL over
LANG?If we were to set only one, it is probably more sensible to set LC_ALL, I suspect, but it may be better to set both, which sends a sign to the readers that we know what we are doing ;-)