Re: [PATCH 3/3] rebase -i: handle core.commentChar=auto
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 22, 2016, 16:04 UTC
- Message-ID
- <alpine.DEB.2.20.1611221703170.3746@virtualbox>
- In-Reply-To
- <975c0002-8afe-efa6-d967-72f2a0d21169@kdbg.org>
Hi Hannes,
On Mon, 21 Nov 2016, Johannes Sixt wrote:
Show 16 quoted lines
> Am 21.11.2016 um 15:18 schrieb Johannes Schindelin:
> > -comment_char=$(git config --get core.commentchar 2>/dev/null | cut -c1)
> > -: ${comment_char:=#}
> > +comment_char=$(git config --get core.commentchar 2>/dev/null)
> > +case "$comment_char" in
> > +''|auto)
> > + comment_char=#
> > + ;;
> > +?)
> > + ;;
> > +*)
> > + comment_char=$(comment_char | cut -c1)
>
> comment_char is a command? Did you mean
>
> comment_char=$(echo "$comment_char" | cut -c1)D'oh.
Show 5 quoted lines
> It could be written without forking a process:
>
> comment_char=${comment_char%${comment_char#?}}
>
> (aka "remove from the end what remains after removing the first character")I was considering this, actually, but it is rather unreadable. Better rewrite it in C, to begin with.
Thanks, Dscho