Re: [PATCH v15 07/13] ref-filter: add support for %(contents:lines=X)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 2, 2015 at 2:37 PM, Matthieu Moy
<Matthieu.Moy@xxxxxxxxxxxxxxx> wrote:
> Karthik Nayak <karthik.188@xxxxxxxxx> writes:
>
>> --- a/builtin/tag.c
>> +++ b/builtin/tag.c
>> @@ -185,6 +185,10 @@ static enum contains_result contains(struct commit *candidate,
>>       return contains_test(candidate, want);
>>  }
>>
>> +/*
>> + * Currently modified and used in ref-filter as append_lines(), will
>> + * eventually be removed as we port tag.c to use ref-filter APIs.
>> + */
>>  static void show_tag_lines(const struct object_id *oid, int lines)
>
> I would rather have one "cut and paste" patch followed by a "modify and
> use" patch for review.
>
> As-is, reading the patch doesn't tell me what change you did.
>
> That said, I did get this information in the interdiff, so I won't
> insist on that.

Its only borrowed slightly, so I don't really see the need for this.
But if you insist, we could do that .

>
>> +static void append_lines(struct strbuf *out, const char *buf, unsigned long size, int lines)
>> +{
>> +     int i;
>> +     const char *sp, *eol;
>> +     size_t len;
>> +
>> +     if ((sp = strstr(buf, "\n\n")) && (sp <= buf + size))
>> +             size += 2;
>
> Why is this "size += 2" needed?
>

We pass size as "sublen + bodylen - siglen" if there exists a "\n\n"
between sublen and bodylen this is not accounted for. hence we
add 2 here.

-- 
Regards,
Karthik Nayak
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]