Open aaferrari opened 4 years ago
git-store-meta already use UTC time, which will be converted to corresponding local time on any device.
Your case seems to be an issue that timestamp for the source file gets altered. Write a script or seek for a tool for batch file time modification. It's out of scope of git-store-meta.
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 thetime_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.