Re: [PATCH v15 07/13] ref-filter: add support for %(contents:lines=X)
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Sep 2, 2015, 14:16 UTC
- Message-ID
- <CAOLa=ZTB_uMvKjU=f9UgmvOmeZD4YtFL_Gv1+VvZAgDV-6WYDA@mail.gmail.com>
- In-Reply-To
- <vpq8u8ptcjq.fsf@anie.imag.fr>
On Wed, Sep 2, 2015 at 2:37 PM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
Show 21 quoted lines
> Karthik Nayak <karthik.188@gmail.com> 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 .
Show 12 quoted lines
>
>> +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