Re: [PATCH] blame: draft of line format
- From
Edmundo Carmona Antoranz <eantoranz@gmail.com>
- Date
- Mar 6, 2017, 23:29 UTC
- Message-ID
- <CAOc6etZjvpiQ65JHWzVeEqUzO0uJv8UjuWw7mbvCL5Om9weZLg@mail.gmail.com>
- In-Reply-To
- <20170131194138.fbcbdnkfjgizxnoa@sigill.intra.peff.net>
On Tue, Jan 31, 2017 at 1:41 PM, Jeff King <peff@peff.net> wrote:
Show 23 quoted lines
> On Mon, Jan 30, 2017 at 08:28:30PM -0600, Edmundo Carmona Antoranz wrote:
>
>> +static void pretty_info(char* revid, struct blame_entry *ent, struct strbuf *rev_buffer)
>> +{
>> + struct pretty_print_context ctx = {0};
>> + struct rev_info rev;
>> +
>> + struct strbuf format = STRBUF_INIT;
>> + strbuf_addstr(&format, format_line);
>> + ctx.fmt = CMIT_FMT_USERFORMAT;
>> + get_commit_format(format.buf, &rev);
>> + pretty_print_commit(&ctx, ent->suspect->commit, rev_buffer);
>> + strbuf_release(&format);
>> +}
>
> I think this may be less awkward if you use format_commit_message() as
> the entry point. Then you do not need a rev_info struct at all, it
> touches fewer global variables, etc.
>
> I don't know if that would cause the other difficulties you mentioned,
> though.
>
> -PeffThanks for the tip, Peff. It made the code to get rev info much shorter. I'll work on some other improvements and then I'll send another patch.
Best regards!