Re: [PATCH] git-prompt: fix reading files with windows line endings
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 30, 2017, 01:51 UTC
- Message-ID
- <alpine.DEB.2.21.1.1711300250320.6482@virtualbox>
- In-Reply-To
- <20171130010811.17369-1-szeder.dev@gmail.com>
Hi Gábor,
On Thu, 30 Nov 2017, SZEDER Gábor wrote:
Show 20 quoted lines
> > > diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> > > index c6cbef38c2..71a64e7959 100644
> > > --- a/contrib/completion/git-prompt.sh
> > > +++ b/contrib/completion/git-prompt.sh
> > > @@ -282,7 +282,7 @@ __git_eread ()
> > > {
> > > local f="$1"
> > > shift
> > > - test -r "$f" && read "$@" <"$f"
> > > + test -r "$f" && read "$@" <"$f" && export $@="${!@%$'\r'}"
>
> I don't think that export is necessary here.
>
> > As far as I understand, $'\r' is a Bash-only construct, and this file
> > (git-prompt.sh) is targeting other Unix shells, too.
>
> The only other shell the prompt (and completion) script is targeting
> is ZSH, and ZSH understands this construct. We already use this
> construct to set IFS in several places in both scripts for a long
> time, so it should be fine here, too.That's good to know! I should have `git grep`ped...
Sorry for the noise, Johannes