From ce92030f169f478997a393b55541fb07f59a074b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 07:34:25 +0000 Subject: [PATCH 01/11] Initial plan From 8103ed5613b0a8dfb90213c618408e0318d5e79b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 07:49:53 +0000 Subject: [PATCH 02/11] Add comprehensive gix-date baseline tests with relative date support Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- .../fixtures/generate_git_date_baseline.sh | 115 ++++++++++++++++-- .../generate_git_date_baseline.tar | Bin 50176 -> 51200 bytes gix-date/tests/time/baseline.rs | 22 +++- 3 files changed, 125 insertions(+), 12 deletions(-) diff --git a/gix-date/tests/fixtures/generate_git_date_baseline.sh b/gix-date/tests/fixtures/generate_git_date_baseline.sh index 1b241350b1d..6eaf144be56 100755 --- a/gix-date/tests/fixtures/generate_git_date_baseline.sh +++ b/gix-date/tests/fixtures/generate_git_date_baseline.sh @@ -22,25 +22,118 @@ function baseline() { } >> baseline.git } -# success +# Relative dates use a fixed "now" timestamp for reproducibility +# GIT_TEST_DATE_NOW sets Git's internal "now" to a specific Unix timestamp +# We use 1000000000 (Sun Sep 9 01:46:40 UTC 2001) as our reference point +function baseline_relative() { + local test_date="$1" # first argument is the relative date to test + local test_name="$2" # second argument is the format name (usually empty for relative dates) -# date formats following to https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt + local status=0 + GIT_TEST_DATE_NOW=1000000000 git -c section.key="$test_date" config --type=expiry-date section.key || status="$?" -# short -# ODO -#baseline '2022-08-22' -# rfc2822 + { + echo "$test_date" + echo "$test_name" + echo "$status" + if [ "$status" = 0 ]; then + GIT_TEST_DATE_NOW=1000000000 git -c section.key="$test_date" config --type=expiry-date section.key + else + echo '-1' + fi + } >> baseline.git +} + +# ============================================================================ +# FIXED DATE FORMATS +# ============================================================================ +# Following https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt + +# Note: SHORT format (YYYY-MM-DD) is NOT included in baseline tests because +# Git fills in current time-of-day, making it non-reproducible for baseline comparison. +# SHORT format is tested separately in the unit tests. + +# RFC2822 format: "Day, DD Mon YYYY HH:MM:SS +/-ZZZZ" baseline 'Thu, 18 Aug 2022 12:45:06 +0800' 'RFC2822' -# iso8601 +baseline 'Sat, 01 Jan 2000 00:00:00 +0000' 'RFC2822' +baseline 'Fri, 13 Feb 2009 23:31:30 +0000' 'RFC2822' # Unix timestamp 1234567890 + +# GIT_RFC2822 format: like RFC2822 but with non-padded day +baseline 'Thu, 1 Aug 2022 12:45:06 +0800' '' +baseline 'Sat, 1 Jan 2000 00:00:00 +0000' '' + +# ISO8601 format: "YYYY-MM-DD HH:MM:SS +/-ZZZZ" baseline '2022-08-17 22:04:58 +0200' 'ISO8601' -# iso8601_strict +baseline '2000-01-01 00:00:00 +0000' 'ISO8601' +baseline '1970-01-01 00:00:00 +0000' 'ISO8601' + +# ISO8601_STRICT format: "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ" baseline '2022-08-17T21:43:13+08:00' 'ISO8601_STRICT' -# default +baseline '2000-01-01T00:00:00+00:00' 'ISO8601_STRICT' +baseline '2009-02-13T23:31:30+00:00' 'ISO8601_STRICT' # Unix timestamp 1234567890 + +# DEFAULT format (Git's default): "Day Mon D HH:MM:SS YYYY +/-ZZZZ" baseline 'Thu Sep 04 2022 10:45:06 -0400' '' # cannot round-trip, incorrect day-of-week baseline 'Sun Sep 04 2022 10:45:06 -0400' 'GITOXIDE' -# unix +baseline 'Thu Aug 18 12:45:06 2022 +0800' '' + +# UNIX timestamp format +# Note: Git only treats numbers >= 100000000 as UNIX timestamps. +# Smaller numbers are interpreted as date components. baseline '1234567890' 'UNIX' -# raw +baseline '100000000' 'UNIX' +baseline '946684800' 'UNIX' # 2000-01-01 00:00:00 UTC + +# RAW format: "SECONDS +/-ZZZZ" +# Note: Git only treats timestamps >= 100000000 as raw format. +# Smaller numbers are interpreted as date components. baseline '1660874655 +0800' 'RAW' +baseline '1660874655 -0800' 'RAW' +baseline '100000000 +0000' 'RAW' +baseline '1234567890 +0000' 'RAW' +baseline '946684800 +0000' 'RAW' + +# Note: Git does not support negative timestamps through --type=expiry-date +# gix-date does support them, but they can't be tested via the baseline. + +# ============================================================================ +# RELATIVE DATE FORMATS +# ============================================================================ +# These tests use GIT_TEST_DATE_NOW=1000000000 (Sun Sep 9 01:46:40 UTC 2001) + +# Seconds +baseline_relative '1 second ago' '' +baseline_relative '2 seconds ago' '' +baseline_relative '30 seconds ago' '' + +# Minutes +baseline_relative '1 minute ago' '' +baseline_relative '2 minutes ago' '' +baseline_relative '30 minutes ago' '' + +# Hours +baseline_relative '1 hour ago' '' +baseline_relative '2 hours ago' '' +baseline_relative '12 hours ago' '' + +# Days +baseline_relative '1 day ago' '' +baseline_relative '2 days ago' '' +baseline_relative '7 days ago' '' + +# Weeks +baseline_relative '1 week ago' '' +baseline_relative '2 weeks ago' '' +baseline_relative '4 weeks ago' '' + +# Months +baseline_relative '1 month ago' '' +baseline_relative '2 months ago' '' +baseline_relative '6 months ago' '' + +# Years +baseline_relative '1 year ago' '' +baseline_relative '2 years ago' '' +baseline_relative '10 years ago' '' # Note that we can't necessarily put 64bit dates here yet as `git` on the system might not yet support it. diff --git a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar index 073cb0db8a36dfea2b2680f77aa0db659517aa04..e88fd52af0af0528ce87fc3cf11e1ef669d8abf6 100644 GIT binary patch delta 4217 zcmbVP-EJF26wbOPLR+YsQVFR7G)29lO?>8m*H@%Pky4?e#s&gHMNYDf-GE*BN2ph> z5JFs`IDQ4h73xKT5O+KSZ@?RH%^hcE*YWO}W(HeUe$LrB-}%0CX6EekA1*yVzI5CX zTCM;9)sp6aqse|&sHBuKsqJ$V6z3~MPFumjmC<0>>JzfkA9cG)f3k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5Cdb=Twa-?wSo+VZK#d^sqsPqxVo}sdEs9HpTGW8UCWs^xlM`dBfxp%s-S`G8 zI^MPCiuWCgxlA(5^*HB7VE>B+q3*AA8FOzi=0VtFKyNC0B(4MY+g7U`tV{lk` z;8ml>AM+orOfWy;s4@%x(n@}?5N2>V=S~LLid$XI0%H^f)A_B+#ax^ahb0H4G`Vq% zDTpIPa!!b7O(K2#kV(C}{y62NcEv_pBjpUq@g#byB$ohDILG8&;3D zUv$R6W{XrcLO`UV_U5Gto0FX}gvqo81jQcDQzmR?5f})yR2PRS5*apgR=&qH1Jgud zFL!5#LlV@?v`HrrMXh0|@{C diff --git a/gix-date/tests/time/baseline.rs b/gix-date/tests/time/baseline.rs index 67b9e95f8cd..29e625222bc 100644 --- a/gix-date/tests/time/baseline.rs +++ b/gix-date/tests/time/baseline.rs @@ -6,6 +6,7 @@ use gix_date::{ }; use gix_testtools::Result; use std::sync::LazyLock; +use std::time::Duration; struct Sample { format_name: Option, @@ -13,6 +14,18 @@ struct Sample { seconds: SecondsSinceUnixEpoch, } +/// Returns true if the pattern looks like a relative date (e.g., "1 day ago"). +fn is_relative_date(pattern: &str) -> bool { + pattern.ends_with(" ago") +} + +/// The fixed "now" timestamp used for testing relative dates. +/// This matches GIT_TEST_DATE_NOW=1000000000 in the baseline script. +/// This is Sun Sep 9 01:46:40 UTC 2001. +fn fixed_now() -> SystemTime { + std::time::UNIX_EPOCH + Duration::from_secs(1_000_000_000) +} + static BASELINE: LazyLock> = LazyLock::new(|| { (|| -> Result<_> { let base = gix_testtools::scripted_fixture_read_only("generate_git_date_baseline.sh")?; @@ -53,7 +66,13 @@ fn parse_compare_format() { }, ) in BASELINE.iter() { - let res = gix_date::parse(pattern.as_str(), Some(SystemTime::now())); + // Use fixed_now() for relative dates, current time for absolute dates + let now = if is_relative_date(pattern) { + Some(fixed_now()) + } else { + Some(SystemTime::now()) + }; + let res = gix_date::parse(pattern.as_str(), now); assert_eq!( res.is_ok(), *exit_code == 0, @@ -68,6 +87,7 @@ fn parse_compare_format() { if let Some(format_name) = format_name { let reformatted = t .format(match format_name.as_str() { + "SHORT" => Format::Custom(format::SHORT), "RFC2822" => Format::Custom(format::RFC2822), "ISO8601" => Format::Custom(format::ISO8601), "ISO8601_STRICT" => Format::Custom(format::ISO8601_STRICT), From a6c8d229ab2f55a6ff96642494f3709ee3b528e1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 07:54:43 +0000 Subject: [PATCH 03/11] Improve documentation for is_relative_date function Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- gix-date/tests/time/baseline.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gix-date/tests/time/baseline.rs b/gix-date/tests/time/baseline.rs index 29e625222bc..d983a5bf121 100644 --- a/gix-date/tests/time/baseline.rs +++ b/gix-date/tests/time/baseline.rs @@ -14,7 +14,10 @@ struct Sample { seconds: SecondsSinceUnixEpoch, } -/// Returns true if the pattern looks like a relative date (e.g., "1 day ago"). +/// Returns true if the pattern looks like a relative date of the form "N unit ago". +/// Note: This only covers the relative dates tested in the baseline (e.g., "1 day ago"). +/// Other relative formats like "yesterday", "last week" etc. are not included in baseline +/// testing because they would require additional handling in the baseline script. fn is_relative_date(pattern: &str) -> bool { pattern.ends_with(" ago") } From c5cb9f6b16c55fede10307ddfdcfe457beb490cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 08:20:49 +0000 Subject: [PATCH 04/11] Regenerate baseline tar archive to fix CI Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- .../generate_git_date_baseline.tar | Bin 51200 -> 51200 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar index e88fd52af0af0528ce87fc3cf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P&fg{Hl3nV!WR%7A# zwwJ*{yOvo&WZY#{WIXUPq?OvyVU3m~9glJyPkjt*Zs2-l!O$3+>?-P5^)a}?bLi@j zc!|)0CTnaJ867V}2@nng1gGiPWfzcf&&%Kv`}q7o07v%jJkTNr`j$XHm5Cb~mBiLnHx6O>KPg zX8QT$1FmhivZ49S9}pY`P6$<&8A?D7^QJKI>XCr^*nH5HP-vJx=tsY5Q-1u1dA{Bq GZnA%iPX1N^ From 9e16116316571f5ea12748c1e740dd0aa3ad6b69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 09:32:03 +0000 Subject: [PATCH 05/11] Add date parsing tests from Git's t0006-date.sh test suite Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- .../fixtures/generate_git_date_baseline.sh | 50 ++++++++++++++---- .../generate_git_date_baseline.tar | Bin 51200 -> 51200 bytes 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/gix-date/tests/fixtures/generate_git_date_baseline.sh b/gix-date/tests/fixtures/generate_git_date_baseline.sh index 6eaf144be56..41abd6b6564 100755 --- a/gix-date/tests/fixtures/generate_git_date_baseline.sh +++ b/gix-date/tests/fixtures/generate_git_date_baseline.sh @@ -47,7 +47,8 @@ function baseline_relative() { # ============================================================================ # FIXED DATE FORMATS # ============================================================================ -# Following https://git-scm.com/docs/git-log#Documentation/git-log.txt---dateltformatgt +# Tests from https://github.com/git/git/blob/master/t/t0006-date.sh +# Only including formats that gix-date currently supports. # Note: SHORT format (YYYY-MM-DD) is NOT included in baseline tests because # Git fills in current time-of-day, making it non-reproducible for baseline comparison. @@ -57,25 +58,40 @@ function baseline_relative() { baseline 'Thu, 18 Aug 2022 12:45:06 +0800' 'RFC2822' baseline 'Sat, 01 Jan 2000 00:00:00 +0000' 'RFC2822' baseline 'Fri, 13 Feb 2009 23:31:30 +0000' 'RFC2822' # Unix timestamp 1234567890 +baseline 'Wed, 15 Jun 2016 16:13:20 +0200' 'RFC2822' # from git t0006 +baseline 'Thu, 7 Apr 2005 15:14:13 -0700' '' # from git t0006 # GIT_RFC2822 format: like RFC2822 but with non-padded day baseline 'Thu, 1 Aug 2022 12:45:06 +0800' '' baseline 'Sat, 1 Jan 2000 00:00:00 +0000' '' -# ISO8601 format: "YYYY-MM-DD HH:MM:SS +/-ZZZZ" +# ISO8601 format: "YYYY-MM-DD HH:MM:SS +/-ZZZZ" from git t0006 baseline '2022-08-17 22:04:58 +0200' 'ISO8601' baseline '2000-01-01 00:00:00 +0000' 'ISO8601' baseline '1970-01-01 00:00:00 +0000' 'ISO8601' +baseline '2008-02-14 20:30:45 +0000' '' # from git t0006 +baseline '2008-02-14 20:30:45 -0500' '' # from git t0006 +baseline '2016-06-15 16:13:20 +0200' 'ISO8601' # from git t0006 + +# Note: ISO8601 with dots (2008.02.14 20:30:45 -0500) is supported by Git +# but not yet supported by gix-date. # ISO8601_STRICT format: "YYYY-MM-DDTHH:MM:SS+ZZ:ZZ" baseline '2022-08-17T21:43:13+08:00' 'ISO8601_STRICT' baseline '2000-01-01T00:00:00+00:00' 'ISO8601_STRICT' baseline '2009-02-13T23:31:30+00:00' 'ISO8601_STRICT' # Unix timestamp 1234567890 +baseline '2016-06-15T16:13:20+02:00' 'ISO8601_STRICT' # from git t0006 + +# Timezone edge cases from git t0006 (that gix-date supports) +baseline '1970-01-01 00:00:00 +0000' '' +baseline '1970-01-01 01:00:00 +0100' '' +baseline '1970-01-02 00:00:00 +1100' '' # DEFAULT format (Git's default): "Day Mon D HH:MM:SS YYYY +/-ZZZZ" baseline 'Thu Sep 04 2022 10:45:06 -0400' '' # cannot round-trip, incorrect day-of-week baseline 'Sun Sep 04 2022 10:45:06 -0400' 'GITOXIDE' baseline 'Thu Aug 18 12:45:06 2022 +0800' '' +baseline 'Wed Jun 15 16:13:20 2016 +0200' '' # from git t0006 # UNIX timestamp format # Note: Git only treats numbers >= 100000000 as UNIX timestamps. @@ -83,6 +99,7 @@ baseline 'Thu Aug 18 12:45:06 2022 +0800' '' baseline '1234567890' 'UNIX' baseline '100000000' 'UNIX' baseline '946684800' 'UNIX' # 2000-01-01 00:00:00 UTC +baseline '1466000000' 'UNIX' # from git t0006 # RAW format: "SECONDS +/-ZZZZ" # Note: Git only treats timestamps >= 100000000 as raw format. @@ -92,48 +109,61 @@ baseline '1660874655 -0800' 'RAW' baseline '100000000 +0000' 'RAW' baseline '1234567890 +0000' 'RAW' baseline '946684800 +0000' 'RAW' +baseline '1466000000 +0200' 'RAW' # from git t0006 +baseline '1466000000 -0200' 'RAW' # from git t0006 # Note: Git does not support negative timestamps through --type=expiry-date # gix-date does support them, but they can't be tested via the baseline. # ============================================================================ -# RELATIVE DATE FORMATS +# RELATIVE DATE FORMATS from git t0006 # ============================================================================ # These tests use GIT_TEST_DATE_NOW=1000000000 (Sun Sep 9 01:46:40 UTC 2001) -# Seconds +# Seconds - from git t0006 check_relative baseline_relative '1 second ago' '' baseline_relative '2 seconds ago' '' baseline_relative '30 seconds ago' '' +baseline_relative '5 seconds ago' '' # from git t0006 check_relative 5 -# Minutes +# Minutes - from git t0006 check_relative 300 = 5 minutes baseline_relative '1 minute ago' '' baseline_relative '2 minutes ago' '' baseline_relative '30 minutes ago' '' +baseline_relative '5 minutes ago' '' +baseline_relative '10 minutes ago' '' -# Hours +# Hours - from git t0006 check_relative 18000 = 5 hours baseline_relative '1 hour ago' '' baseline_relative '2 hours ago' '' baseline_relative '12 hours ago' '' +baseline_relative '5 hours ago' '' -# Days +# Days - from git t0006 check_relative 432000 = 5 days baseline_relative '1 day ago' '' baseline_relative '2 days ago' '' baseline_relative '7 days ago' '' +baseline_relative '5 days ago' '' +baseline_relative '3 days ago' '' -# Weeks +# Weeks - from git t0006 check_relative 1728000 = 3 weeks (20 days) baseline_relative '1 week ago' '' baseline_relative '2 weeks ago' '' baseline_relative '4 weeks ago' '' +baseline_relative '3 weeks ago' '' -# Months +# Months - from git t0006 check_relative 13000000 ≈ 5 months baseline_relative '1 month ago' '' baseline_relative '2 months ago' '' baseline_relative '6 months ago' '' +baseline_relative '5 months ago' '' +baseline_relative '3 months ago' '' +baseline_relative '12 months ago' '' -# Years +# Years - from git t0006 check_relative 630000000 = 20 years baseline_relative '1 year ago' '' baseline_relative '2 years ago' '' baseline_relative '10 years ago' '' +baseline_relative '20 years ago' '' # Note that we can't necessarily put 64bit dates here yet as `git` on the system might not yet support it. diff --git a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar index 9aae4d4eceff551b7bf22b0b018b7088e0f04734..391790605cb381b242a00ea7db789cfcea8d8ee5 100644 GIT binary patch delta 3769 zcmbW4TW?!M5XZe~6_8s>1ITJCK>OUr@yuS2tqLVYAR0mFCA}aaB)4|rG{TM?TUDh3 zdF25q_CY)#E)_zR-~m-hbLk7^BT%XDdLTIhN5DyG&?k};Xl zb1nuoH*$Kg$yuZP7#G-Uq~oZI0b0sz3$lW`l23UZV@HY6a55y)Rv*+sHRY${7JHEx zXPpcXv?nqQ;hFQd;+&syGAx3~Fto6Kv3i{yCmqVk0Hd?DYpn8Pm{>>K$xsT0YuA&} zVR_Q=wUdDchID{uKE7dxiSeGB0Ym%T2=wbEvoYgy7XwkzhRf6yD7piFGzT=zub`r7ya<-e(O|mZmr>9$6@LHluP-1df+(V*;S~uL zrD^qOp=hK433Pi_I!|j2jVppqjg#eM9GW7SBDtOM_Wb1!0|Pkdt$^_E){liqT{3Ha ze-=p$*S88U>?sQ`ZoTmi%_XPG7K(uM;eZtY`jE$%c#<*;9@}Cw?wOSdAUwIA&fUO>@ZQcm z)8X$sC+Pk6&Lw)kyjvKL5{3|cWhy+kJ6F)W(dxEWd3CWB<)=(fKq35Ucebc`t$HVI z(WI5;%k1w~K@dLO{h%QE?RtGVH6_46oAAv?7v9(W(^j+7IIsoA20-i4av4jR3W@53 t92HrU3FtpN2$vttouHb%Q?DL)E=>?9T5ogu^dD>!?*IABSGdBi{tH;Cr&Ry| delta 3599 zcmbW3TWi!n6vsDBQCmyvdP97WC_bq4GBcUUC?a%4sZ`VoD)qWbp5gxI+me%qDtW+DznxqQ>y*iCS2yTGmXy(6RV_^ngBvd%ODLqwpqz0(-8Bml+N>QlxWmHdC8r8frS$Ndp62vsYY^oQ7IRKxb|5fJG9Je`L`s}DJGC}<5EyVIv1wd5$W6OzG%IsYI)+l}BqGgW z1nEtuu~C^%(=oakBrw8e6t`*5v^K{P7@ImYt_|l<8BkSVz*wWqDgwhfNrnK$=1pj{ zD)W9i20q9W#fEd}K`3t?Xl-t#V+eH;y&K5byqVIGHoJt0N}=xJ@X5u)@{vHS#kFBf z!aAlxzc!lI=>F~bBLO_0v40b6%UQS7avC{gJBbWsx(%TmTL0UjBZmuzmK|zDBQQc+Tv;tyJ8f`=H=(y**+R|mE8<@x(nMhJ-qA>Tv+i7D| z{q5uWyC3S}`zK0$c&JXypHg4vpR1Q22h^rdC)J}*N0qVArzRKr)%S&C>c;1z>fm@^ zzE}j~f=O@KEnaiOQn8ppGQn_@^40{b2e^Ldg*RvN{iy;%t&Ha&w*@Za+xOap5+Wq) z0;MMBw%_{+$++P^7QuFOU3aTB)iH}OiQ5U2By#TE0VGS4yui0uw; Date: Tue, 25 Nov 2025 10:02:42 +0000 Subject: [PATCH 06/11] Regenerate baseline tar archive for CI compatibility Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- .../generate_git_date_baseline.tar | Bin 51200 -> 52224 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar b/gix-date/tests/fixtures/generated-archives/generate_git_date_baseline.tar index 391790605cb381b242a00ea7db789cfcea8d8ee5..9fb21409c9e0a1d6bd092c6f18326a5a57464603 100644 GIT binary patch delta 3482 zcmbW4O;6NN6o%)v1aTw|Gcm@vFr#s0gt?!+5I0~nF)oZ74We-@LxBReWTqJ07#7A5 zqY2~PxHPO>7-9zZ{ssSmf5mf)U~CCJw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vc}l1v75376^M#U(s9it7JIoG5nGGkm@Tra#YH>o>;}?pB4IRb vs0DeWuK9z3E5He#w1O7!D> Date: Tue, 25 Nov 2025 12:39:06 +0000 Subject: [PATCH 07/11] Add support for Git's flexible date formats (ISO8601 dots, compact ISO8601, Z suffix, flexible offsets) Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- gix-date/src/parse.rs | 308 ++++++++++++++++++ .../fixtures/generate_git_date_baseline.sh | 31 +- .../generate_git_date_baseline.tar | Bin 52224 -> 52736 bytes gix-date/tests/time/parse.rs | 20 +- 4 files changed, 344 insertions(+), 15 deletions(-) diff --git a/gix-date/src/parse.rs b/gix-date/src/parse.rs index 7f71c95180c..278e6a4b0a5 100644 --- a/gix-date/src/parse.rs +++ b/gix-date/src/parse.rs @@ -156,6 +156,9 @@ pub(crate) mod function { Time::new(val.timestamp().as_second(), val.offset().seconds()) } else if let Ok(val) = strptime_relaxed(ISO8601_STRICT.0, input) { Time::new(val.timestamp().as_second(), val.offset().seconds()) + } else if let Some(val) = parse_git_date_format(input) { + // Git-style flexible date parsing (ISO8601 with dots, compact formats, Z suffix, etc.) + val } else if let Ok(val) = strptime_relaxed(GITOXIDE.0, input) { Time::new(val.timestamp().as_second(), val.offset().seconds()) } else if let Ok(val) = strptime_relaxed(DEFAULT.0, input) { @@ -282,6 +285,311 @@ pub(crate) mod function { Time { seconds, offset }.into() } + /// Parse Git-style flexible date formats that aren't covered by standard strptime: + /// - ISO8601 with dots: `2008.02.14 20:30:45 -0500` + /// - Compact ISO8601: `20080214T203045`, `20080214T20:30:45`, `20080214T2030`, `20080214T20` + /// - Z suffix for UTC: `1970-01-01 00:00:00 Z` + /// - 2-digit hour offset: `2008-02-14 20:30:45 -05` + /// - Colon-separated offset: `2008-02-14 20:30:45 -05:00` + /// - Subsecond precision (ignored): `20080214T203045.019-04:00` + fn parse_git_date_format(input: &str) -> Option