From: Patrick Steinhardt <ps@pks.im>
To: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] [Outreachy] patch-ids: fix NEEDSWORK timezone parsing in fast-import.c
Date: Fri, 10 Oct 2025 07:30:38 +0200 [thread overview]
Message-ID: <aOiZ_v3bO35oVWf-@pks.im> (raw)
In-Reply-To: <20251009234957.1789543-1-okhuomonajayi54@gmail.com>
On Fri, Oct 10, 2025 at 12:49:57AM +0100, Okhuomon Ajayi wrote:
> Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
> ---
For a change like this it is important to explain what the problem is,
why it is a problem and how your change improves the code for the
better. All of this needs to be patr of the commit message so that the
reader can understand what you're actually doing.
Also, if this fixes a real issue, is it possible to demonstrate the
issue and the fix with a test?
> diff --git a/builtin/fast-import.c b/builtin/fast-import.c
> index 606c6aea82..695e1a0ae1 100644
> --- a/builtin/fast-import.c
> +++ b/builtin/fast-import.c
> @@ -1959,14 +1959,15 @@ static int validate_raw_date(const char *src, struct strbuf *result, int strict)
> return -1;
>
> num = strtoul(src + 1, &endp, 10);
> - /*
> - * NEEDSWORK: check for brokenness other than num > 1400, such as
> - * (num % 100) >= 60, or ((num % 100) % 15) != 0 ?
> - */
> - if (errno || endp == src + 1 || *endp || /* did not parse */
> - (strict && (1400 < num)) /* parsed a broken timezone */
> - )
> +
> +
> + unsigned int hours = num / 100;
> + unsigned int minutes = num % 100;
> +
> + if (errno || endp == src + 1 || *endp ||
> + (strict && (num > 1400 || minutes >=60 || minutes % 15 != 0))){
> return -1;
> + }
Despite the formatting issues I also think that this here is becoming
hard to read. It may make sense to split this up into multiple
conditions.
Thanks!
Patrick
next prev parent reply other threads:[~2025-10-10 5:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 23:49 [PATCH] [Outreachy] patch-ids: fix NEEDSWORK timezone parsing in fast-import.c Okhuomon Ajayi
2025-10-09 23:57 ` Kristoffer Haugsbakk
2025-10-10 5:30 ` Patrick Steinhardt [this message]
2025-10-10 15:45 ` Junio C Hamano
2025-10-10 17:16 ` Okhuomon Ajayi
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=aOiZ_v3bO35oVWf-@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=okhuomonajayi54@gmail.com \
/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 NNTP newsgroup(s).