mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-13 08:57:56 -05:00
Merge branch 'ls/doc-raw-timestamp-prefix' into jch
Documentation and tests have been added to clarify that Git's internal raw timestamp format requires a `@` prefix for values less than 100,000,000 to prevent ambiguity with other formats like YYYYMMDD. * ls/doc-raw-timestamp-prefix: doc: document and test `@` prefix for raw timestamps
This commit is contained in:
@@ -9,6 +9,11 @@ Git internal format::
|
||||
`<unix-timestamp>` is the number of seconds since the UNIX epoch.
|
||||
`<time-zone-offset>` is a positive or negative offset from UTC.
|
||||
For example CET (which is 1 hour ahead of UTC) is `+0100`.
|
||||
+
|
||||
It is safer to prepend the `<unix-timestamp>` with `@` (e.g.,
|
||||
`@0 +0000`), which forces Git to interpret it as a raw timestamp. This
|
||||
is required for values less than 100,000,000 (which have fewer than 9
|
||||
digits) to avoid confusion with other date formats like `YYYYMMDD`.
|
||||
|
||||
RFC 2822::
|
||||
The standard date format as described by RFC 2822, for example
|
||||
|
||||
@@ -138,6 +138,13 @@ check_parse '1969-12-31 23:59:59 Z' bad
|
||||
check_parse '1969-12-31 23:59:59 +11' bad
|
||||
check_parse '1969-12-31 23:59:59 -11' bad
|
||||
|
||||
# pathologically small timestamps requiring `@` prefix
|
||||
check_parse '@0 +0000' '1970-01-01 00:00:00 +0000'
|
||||
check_parse '@99999999 +0000' '1973-03-03 09:46:39 +0000'
|
||||
check_parse '99999999 +0000' bad
|
||||
check_parse '@100000000 +0000' '1973-03-03 09:46:40 +0000'
|
||||
check_parse '100000000 +0000' '1973-03-03 09:46:40 +0000'
|
||||
|
||||
REQUIRE_64BIT_TIME=HAVE_64BIT_TIME
|
||||
check_parse '2099-12-31 23:59:59' '2099-12-31 23:59:59 +0000'
|
||||
check_parse '2099-12-31 23:59:59 +00' '2099-12-31 23:59:59 +0000'
|
||||
@@ -237,6 +244,10 @@ check_approxidate '6AM, June 7, 2009' '2009-06-07 06:00:00'
|
||||
check_approxidate '2008-12-01' '2008-12-01 19:20:00'
|
||||
check_approxidate '2009-12-01' '2009-12-01 19:20:00'
|
||||
|
||||
# ambiguous raw timestamp
|
||||
check_approxidate '2000 +0000' '2000-08-30 19:20:00'
|
||||
check_approxidate '@2000 +0000' '1970-01-01 00:33:20'
|
||||
|
||||
check_date_format_human() {
|
||||
t=$(($GIT_TEST_DATE_NOW - $1))
|
||||
echo "$t -> $2" >expect
|
||||
|
||||
Reference in New Issue
Block a user