Re: [PATCH v5 4/5] rebase -i: support --ignore-date
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 26, 2020, 16:29 UTC
- Message-ID
- <xmqqftahhjtq.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200626095528.117524-5-phillip.wood123@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
> +/* Construct a free()able author string with current time as the author date */
> +static char *ignore_author_date(const char *author)
> +{
> + int len = strlen(author);I'd rather not to see this initialization, because ...
> + struct ident_split ident;
> + struct strbuf new_author = STRBUF_INIT;
> +
> + if (split_ident_line(&ident, author, len) < 0) {... it is away from this line. This line is better written
if (split_ident_line(&ident, author, strlen(author)) < 0) {to show what the third parameter is about. It is not just "len", but is the length of the second parameter, author.
Show 9 quoted lines
> + error(_("malformed ident line '%s'"), author);
> + return NULL;
> + }
> +
> + len = ident.mail_end - ident.name_begin + 1;
> + strbuf_addf(&new_author, "%.*s ", len, ident.name_begin);
> + datestamp(&new_author);
> + return strbuf_detach(&new_author, NULL);
> +}