fix: always consider timestamps as UTC when loading from commits #646
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, whilst working on #471 (very slowly every now and then) I realised gitoxide is incorrectly using
replace_offset
when we should be usingto_offset
.Which sounds great, cause what git stores is a timestamp in UTC and an offset explaining in which timezone the commit was made. So we want to apply the offset without changing the time.. however the time crate doesn't store time as unix seconds! So replacing the offset without adjusting the stored day and time is not what we want.
And just to verify for myself I wrote a small script which uses
git
to convert from the hardcoded timestamp in the tests of this repo, to various formats. https://gist.github.com/willstott101/ecbd08d359e7bbf8dbfa0ac26f25b367This script outputs the following (which this patch makes the tests for formatting in this repo match)
Ok for Byron review the PR on video?
If I think the review will be helpful for the community, then I might record and publish a video.