Re: Re* [PATCH v7 1/1] sideband: highlight keywords in remote sideband output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 20, 2018, 14:32 UTC
- Message-ID
- <xmqq6005cdnc.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CAFQ2z_NEBeiHWeC8BLKeBhTq_zA2iN2cTrENfPTdfykyM5uduQ@mail.gmail.com>
Han-Wen Nienhuys <hanwen@google.com> writes:
Show 15 quoted lines
>> @@ -84,6 +86,9 @@ static void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n)
>> for (i = 0; i < ARRAY_SIZE(keywords); i++) {
>> struct keyword_entry *p = keywords + i;
>> int len = strlen(p->keyword);
>> +
>> + if (n <= len)
>> + continue;
>
> I would suggest
>
> if (n < len) continue;
> ..
> if (!strncasecmp(p->keyword, src, len) && (n == len || !isalnum(src[len]))) {
>
> so we colorize a single line that looks like "warning" as wellThat's the kind of thing I would have mentioned in the initial review of the feature, and I do not think it is a bad idea.
I do think it is a bad idea to roll it into this patch, though.