git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] [PATCH] commit.c: Replace starts_with() with skip_prefix()

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 5, 2014, 07:48 UTC
Message-ID
<CAPig+cSQtQ_uvjdA2s3+K8YQLDuMXqqc-jG2AuSM7K52q3_pPQ@mail.gmail.com>
In-Reply-To
<CAPig+cR=9oonOdyOm3y2NpdLxh-sq5qQtSxmmN2dH7+UzRy-gA@mail.gmail.com>
On Tue, Mar 4, 2014 at 5:27 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 20 quoted lines
> On Tue, Mar 4, 2014 at 10:54 AM, Karthik Nayak <karthik.188@gmail.com> wrote:
>> diff --git a/commit.c b/commit.c
>> index 6bf4fe0..71a03e3 100644
>> --- a/commit.c
>> +++ b/commit.c
>> @@ -1111,11 +1114,11 @@ int parse_signed_commit(const unsigned char *sha1,
>>                 char *next = memchr(line, '\n', tail - line);
>>
>>                 next = next ? next + 1 : tail;
>> +               indent_line = skip_prefix(line, gpg_sig_header);
>
> Even stranger variable name for a GPG signature (which has nothing at
> all to do with indentation).
>
>>                 if (in_signature && line[0] == ' ')
>>                         sig = line + 1;
>> -               else if (starts_with(line, gpg_sig_header) &&
>> -                        line[gpg_sig_header_len] == ' ')
>> -                       sig = line + gpg_sig_header_len + 1;
>> +               else if (indent_line && indent_line[1] == ' ')

Also, shouldn't this be checking *indent_line (or indent_line[0]) rather than indent_line[1]?

Show 7 quoted lines
>> +                       sig = indent_line + 2;
>
> Why is this adding 2 rather than 1?
>
>>                 if (sig) {
>>                         strbuf_add(signature, sig, next - sig);
>>                         saw_signature = 1;
Previous: Eric Sunshine
Message 7 of 7 in “commit.c: Replace starts_with() with skip_prefix()”
  1. [PATCH] commit.c: Replace starts_with() with skip_prefix()Karthik Nayak, Mar 4, 2014
  2. Tanay AbhraMar 4, 2014
  3. karthik nayakMar 4, 2014
  4. Eric SunshineMar 4, 2014
  5. Eric SunshineMar 4, 2014
  6. Eric SunshineMar 4, 2014
  7. Eric SunshineMar 5, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.