git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG REPORT] --date argument doesn't validate dates
@ 2020-04-22 20:40 Yuri
  2020-04-22 21:26 ` brian m. carlson
  0 siblings, 1 reply; 2+ messages in thread
From: Yuri @ 2020-04-22 20:40 UTC (permalink / raw)
  To: git

For example, the following command accepts an invalid month "Dx" and an 
invalid year "20221" and sets the month to "Apr" and the year to "2020".


Yuri



$ git commit --amend --no-edit --date "Mon 20 Dx 20221 20:19:19 PST"
[master 668e255] Initial
  Date: Mon Apr 20 20:19:19 2020 -0700
  1 file changed, 1 insertion(+)
  create mode 100644 File
[yuri@yv /usr/home/yuri/github/git-date]$ git log
commit 668e255b54d08ed898e6d44f19954b2116d5a56c (HEAD -> master)
Author: Yuri <yuri@rawbw.com>
Date:   Mon Apr 20 20:19:19 2020 -0700

     Initial


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG REPORT] --date argument doesn't validate dates
  2020-04-22 20:40 [BUG REPORT] --date argument doesn't validate dates Yuri
@ 2020-04-22 21:26 ` brian m. carlson
  0 siblings, 0 replies; 2+ messages in thread
From: brian m. carlson @ 2020-04-22 21:26 UTC (permalink / raw)
  To: Yuri; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

On 2020-04-22 at 20:40:48, Yuri wrote:
> For example, the following command accepts an invalid month "Dx" and an
> invalid year "20221" and sets the month to "Apr" and the year to "2020".

The --date argument accepts a wide variety of formats, including some
formally specified ones, as well generalized handling through the
"approxidate" approach.  So it's designed to operate on formats that are
not well understood and do the best it can with them.  This also allows
it do things like ignore the irrelevant word "ago" in "5 days ago" and
still do the right thing.

If you want to be sure that your date is uniformly understood, then the
best approach is to either use the Git internal format or RFC 3339
(which is a profile of ISO 8601).
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-22 21:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-22 20:40 [BUG REPORT] --date argument doesn't validate dates Yuri
2020-04-22 21:26 ` brian m. carlson

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).