public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: the.tester@mac.com
Cc: git@vger.kernel.org
Subject: Re: Date and time processing issue
Date: Fri, 02 Aug 2024 09:19:23 -0700	[thread overview]
Message-ID: <xmqqplqqew38.fsf@gitster.g> (raw)
In-Reply-To: <B896574C-A150-45AE-A636-ADA9ADF3255A@mac.com> (the tester's message of "Fri, 2 Aug 2024 11:46:30 +0200")

the.tester@mac.com writes:

> To me, the error message is at least misleading. 

Correct.  The error message is prepared for the most common case
where people ask for an invalid format, but does not pay attention
to the fact that some timestamps are not out of range in the Git
timescale and such an out of range timestamp can be fed to the
program.

Something along the following line may be a good first step to fix
it.

 builtin/commit.c | 2 +-
 ident.c          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git c/builtin/commit.c w/builtin/commit.c
index 66427ba82d..24de55ae86 100644
--- c/builtin/commit.c
+++ w/builtin/commit.c
@@ -657,7 +657,7 @@ static void determine_author_info(struct strbuf *author_ident)
 	if (force_date) {
 		struct strbuf date_buf = STRBUF_INIT;
 		if (parse_force_date(force_date, &date_buf))
-			die(_("invalid date format: %s"), force_date);
+			die(_("invalid format or date out of range: %s"), force_date);
 		set_ident_var(&date, strbuf_detach(&date_buf, NULL));
 	}
 
diff --git c/ident.c w/ident.c
index caf41fb2a9..d18773554d 100644
--- c/ident.c
+++ w/ident.c
@@ -528,7 +528,8 @@ const char *fmt_ident(const char *name, const char *email,
 		strbuf_addch(ident, ' ');
 		if (date_str && date_str[0]) {
 			if (parse_date(date_str, ident) < 0)
-				die(_("invalid date format: %s"), date_str);
+				die(_("invalid format or date out of range: %s"),
+				    date_str);
 		}
 		else
 			strbuf_addstr(ident, ident_default_date());


  reply	other threads:[~2024-08-02 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02  9:46 Date and time processing issue the.tester
2024-08-02 16:19 ` Junio C Hamano [this message]
2024-08-04 14:15   ` the.tester
2024-08-05  1:14 ` 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=xmqqplqqew38.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=the.tester@mac.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