Is it possible to set a git commit to have a timestamp prior to 1970? -


unix timestamps signed 32 bit integers (64 bit on systems today, or understand). on software products allows use dates going far 1903 or so.

however, when try following:

git commit -m "this test commit" --date="1960-04-07 18:00:00" 

i receive "fatal: invalid date format" error.

this isn't practical (i'm not time-traveler), i've been wondering using git historical purposes. can forced git plumbing command? on related note: git use 32 bit timestamp, or depend on environment it's built on?

as far commit c64b9b8 (git 0.99, may 2005), time has been referred

<date> 

date in 'seconds since epoch'

commit 6eb8ae0 defines date unsigned long since april 2005.

tldr;

date before unix epoch can stored, cannot sure correctly represented.


trying represent date before has been attempted before: see this thread

the date i'm trying set october 4, 1958, around timestamp -354808800.

first technique, using commit --date flags iso 8601: says "invalid date".

second technique, described in git ml archive, not using porcelain:

git commit git cat-file -p head > tmp.txt # @ point, edit file replace timestamp  git hash-object -t commit -w tmp.txt #=> 2ee8fcc02658e23219143f5bcfe6f9a4615745f9 git update-ref -m 'commit: foo' refs/heads/master \     2ee8fcc02658e23219143f5bcfe6f9a4615745f9 

commit date updated, git show clamps date 0 (jan 1 1970). tig(1) displays 55 years ago actual commit date stored.

last issue: when trying push commit remote repository:

#=> remote: error: object 2ee8fcc02658e23219143f5bcfe6f9a4615745f9:invalid #       author/committer line - bad date #=> remote: fatal: error in object #=> error: unpack failed: index-pack abnormal exit 

finally, when running test-date git sources:

./test-date show -354808800 #=> -354808800 -> in future 

the discussion @ time mentioned:

i not sure there isn't unportability @ lowest level.
freely interchange between time_t , unsigned long in low-level date code. happens work because casting bits , forth between signed , unsigned types works, long end type want.
isn't portable, , there can subtle bugs. see, example, recent 9ba0f033.

the news purely code problem. data format fine. take going through code , switching "unsigned long" "long long" (or time_t, or "gittime_t" if want abstract it).

and fixing parser algorithm @ least in tm_to_time_t()

it not "sed s/unsigned long/long long", rather checking every change make sure aren't introducing new bugs, , code correctly handles signed types.
why nobody has done it. ;)


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -