Re: [PATCH 3/3] rebase -i: handle core.commentChar=auto
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 21, 2016, 19:07 UTC
- Message-ID
- <xmqqy40circz.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <8b783f3d-8fda-b5cb-239f-895b10a22a73@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 14 quoted lines
> Am 21.11.2016 um 19:40 schrieb Junio C Hamano:
>> Johannes Sixt <j6t@kdbg.org> writes:
>>> 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")
>>
>> Hopefully nobody would include any glob metacharacters in there,
>> e.g. "core.commentchar='=*'", which would break that?
>
> Heh. I tested a few variations, but not this one. Make it
>
> comment_char=${comment_char%"${comment_char#?}"}I tried a few implementations of shells, and decided that this is not worth the portability hassle.
Setting comment-char to multi-letter sequence is not supported at all, and this code is protecting itself from that nonsense---it does not need to be fast, and Dscho already gives a fast path for a single letter case in his patch.