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.
It occurred to me to add the
--timezone
/-z
parameter because of this issue, although the idea is to use it in cases like the following:To make it clearer, download this archive, unzip it, run the command
perl .git/hooks/git-store-meta.pl --store -n
and compare the output with the saved .git_store_meta, you will probably see something liketest.txt f 2020-04-02T19:23:50Z
.This mismatch occurs because when unpacking a compressed archive the system usually assumes that the dates on the files correspond to the local time because the compressed archives do not retain the original time zone.
Since Perl doesn't have a transparent way to change the time zones in the timestamps (or if there is one then I haven't figured it out yet) I had to add the
time_compensator
function that does the corresponding adjustment.I was testing it with the repository of this script and with another one I'm working on and it seems to work fine (even so I don't rule out that there might be undiscovered errors). Something I noticed is that when using
--timezone
together with--update
, the adjustment in the dates is not maintained, any idea why this is?It should be noted that
--timezone
does not take into account unusual time zones nor summer/winter time, but should be sufficient for most cases.