From: "René Scharfe" <l.s.r@web.de>
To: Jeff King <peff@peff.net>, Thomas Bock <bockthom@cs.uni-saarland.de>
Cc: Derrick Stolee <derrickstolee@github.com>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: [PATCH 3/3] parse_commit(): handle broken whitespace-only timestamp
Date: Sat, 22 Apr 2023 17:53:10 +0200 [thread overview]
Message-ID: <7f48188b-2e06-9f01-de8d-a24812fb20fe@web.de> (raw)
In-Reply-To: <20230422135001.GA3942563@coredump.intra.peff.net>
Am 22.04.23 um 15:50 schrieb Jeff King:
> diff --git a/commit.c b/commit.c
> index ede810ac1c..56877322d3 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -120,6 +120,16 @@ static timestamp_t parse_commit_date(const char *buf, const char *tail)
> if (dateptr == buf || dateptr == eol)
> return 0;
>
> + /*
> + * trim leading whitespace; parse_timestamp() will do this itself, but
> + * it will walk past the newline at eol while doing so. So we insist
> + * that there is at least one digit here.
> + */
> + while (dateptr < eol && isspace(*dateptr))
> + dateptr++;
> + if (!strchr("0123456789", *dateptr))
You could use (our own) isdigit() here instead. It's more concise and
efficient.
René
next prev parent reply other threads:[~2023-04-22 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-22 13:50 [PATCH 3/3] parse_commit(): handle broken whitespace-only timestamp Jeff King
2023-04-22 15:53 ` René Scharfe [this message]
2023-04-23 0:37 ` Jeff King
2023-04-25 5:56 ` Jeff King
2023-04-24 18:01 ` Junio C Hamano
2023-04-25 5:27 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7f48188b-2e06-9f01-de8d-a24812fb20fe@web.de \
--to=l.s.r@web.de \
--cc=bockthom@cs.uni-saarland.de \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).