From 8b5feb357790549f455131f2ce0c67ab29a19263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 1 Aug 2025 23:45:55 +0400 Subject: [PATCH] WIP: gix-date: handling bad offsets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit from edk2 has an invalid author date offset: https://github.com/tianocore/edk2/commit/630cb8507b2f1d7d7af3ac0f992d40f209dc1cee $ gix cat 630cb8507b2f1d7d7af3ac0f992d40f209dc1cee ... author Ruiyu Ni 1516956202 -3407 But git show can still display it: commit 630cb8507b2f1d7d7af3ac0f992d40f209dc1cee Author: Ray Ni Date: Wed Jan 24 22:36:22 2018 -3407 How to handle it with gix-date? Signed-off-by: Marc-André Lureau --- gix-date/tests/time/format.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gix-date/tests/time/format.rs b/gix-date/tests/time/format.rs index 06e5b8b774c..84c6cf0d166 100644 --- a/gix-date/tests/time/format.rs +++ b/gix-date/tests/time/format.rs @@ -81,6 +81,14 @@ fn git_default() { ); } +#[test] +fn bad_offset() { + assert_eq!( + time_bad_offset().format(gix_date::time::format::DEFAULT), + "Wed Jan 24 22:36:22 2018 -3407" + ); +} + fn time() -> Time { Time { seconds: 123456789, @@ -94,3 +102,10 @@ fn time_dec1() -> Time { offset: 9000, } } + +fn time_bad_offset() -> Time { + Time { + seconds: 1516956202, + offset: -122820, + } +}