-
-
Notifications
You must be signed in to change notification settings - Fork 344
gix_date::Time cannot represent any timestamp, preventing Signature to roundtrip #1923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can work on it. Making an issue rather than an immediate PR in case there is disagreement on the proposed solution of backing |
Thanks for reporting! I manipulated a real commit to use
Then I cherry-picked the commit onto another, compatible one to see what it does when reproducing the commit while changing the committer.
This shows that Git can round-trip such time. Hence, I'd really appreciate if you'd attempt a fix. As this affects commits, the code is far less performance-sensitive than #1917. However, I'd still hope that the benchmarks in While micro-benchmarks won't be decisive here, a far better test will be running
That test will decode commits as fast as possible on one thread and shift additional processing (including parsing them) to another thread. Overall, this line would be the relevant one for performance: gitoxide/gitoxide-core/src/hours/mod.rs Lines 69 to 72 in 8e96ed3
My thinking is that the performance implications of this change will be negligible, but it's better to make sure of that. |
I raised PR 1935 to address this. |
Current behavior 😯
Some timestamps can't be represented by
gix_date::Time
, which means that we don't roundtrip when parsing them into a Commit.For instance, in the wild, we see this commit:
Notice that in the author and commiter fields, the timezone offset:
+051800
does not match the expected[<sign><HH><MM>]
format.Expected behavior 🤔
I think the
time
member ofSignature
should be aBString
and thetime
member ofSignatureRef
should be a& BStr
. We should only parse the timestamp into agix_date::Time
when needed.This would allow round-tripping.
Git behavior
No response
Steps to reproduce 🕹
I wrote this failing test, to show failure to roundtrip:
With that commit,
cargo test
fromgix-actor
outputs:The text was updated successfully, but these errors were encountered: