* Back-dating commits--way back--for constitution.git @ 2010-08-02 18:32 Joel C. Salomon 2010-08-02 18:34 ` Shawn O. Pearce ` (2 more replies) 0 siblings, 3 replies; 36+ messages in thread From: Joel C. Salomon @ 2010-08-02 18:32 UTC (permalink / raw) To: git I'd figured to play with Git in an unusual way: to create a repository for the U.S. Constitution where amendments are presented as patches. E.g., instead of the First Amendment being placed at the end (as is usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). Proposed amendments get branches, which get merged in later. But I'm trying to get the dates right, and I'm missing something. For example, I made the initial commit with the line $ git commit --author="The Philadelphia Convention <>" \ --date="Mon, 17 Sep 1787 12:00:00 EST" but that's not actually setting the commit date to 1787. Am I doing something wrong, or is Git (quite reasonably) unable to accept commit dates that far in the past? --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 18:32 Back-dating commits--way back--for constitution.git Joel C. Salomon @ 2010-08-02 18:34 ` Shawn O. Pearce 2010-08-02 18:41 ` Joel C. Salomon 2010-08-02 21:25 ` Ævar Arnfjörð Bjarmason 2010-08-02 21:48 ` Jakub Narebski 2 siblings, 1 reply; 36+ messages in thread From: Shawn O. Pearce @ 2010-08-02 18:34 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git "Joel C. Salomon" <joelcsalomon@gmail.com> wrote: > I'd figured to play with Git in an unusual way: to create a repository > for the U.S. Constitution where amendments are presented as patches. > E.g., instead of the First Amendment being placed at the end (as is > usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). > Proposed amendments get branches, which get merged in later. > > But I'm trying to get the dates right, and I'm missing something. For > example, I made the initial commit with the line > > $ git commit --author="The Philadelphia Convention <>" \ > --date="Mon, 17 Sep 1787 12:00:00 EST" > > but that's not actually setting the commit date to 1787. > > Am I doing something wrong, or is Git (quite reasonably) unable to > accept commit dates that far in the past? Its probably running into problems with time_t on your system being a 32 bit value, and thus having trouble going before some time in 1901. -- Shawn. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 18:34 ` Shawn O. Pearce @ 2010-08-02 18:41 ` Joel C. Salomon 0 siblings, 0 replies; 36+ messages in thread From: Joel C. Salomon @ 2010-08-02 18:41 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: git On Mon, Aug 2, 2010 at 2:34 PM, Shawn O. Pearce <spearce@spearce.org> wrote: > "Joel C. Salomon" <joelcsalomon@gmail.com> wrote: <snip> >> $ git commit --author="The Philadelphia Convention <>" \ >> --date="Mon, 17 Sep 1787 12:00:00 EST" >> >> but that's not actually setting the commit date to 1787. >> >> Am I doing something wrong, or is Git (quite reasonably) unable to >> accept commit dates that far in the past? > > Its probably running into problems with time_t on your system being a > 32 bit value, and thus having trouble going before some time in 1901. I was afraid of that. Oh, well. Thanks, --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 18:32 Back-dating commits--way back--for constitution.git Joel C. Salomon 2010-08-02 18:34 ` Shawn O. Pearce @ 2010-08-02 21:25 ` Ævar Arnfjörð Bjarmason 2010-08-04 16:38 ` Joel C. Salomon 2010-08-02 21:48 ` Jakub Narebski 2 siblings, 1 reply; 36+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-08-02 21:25 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git On Mon, Aug 2, 2010 at 18:32, Joel C. Salomon <joelcsalomon@gmail.com> wrote: > I'd figured to play with Git in an unusual way: to create a repository > for the U.S. Constitution where amendments are presented as patches. > E.g., instead of the First Amendment being placed at the end (as is > usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). > Proposed amendments get branches, which get merged in later. > > But I'm trying to get the dates right, and I'm missing something. For > example, I made the initial commit with the line As noted by Shawn time_t doesn't like ancient commits. But as an aside I'd like to ask where this project is being hosted. I've wanted to play with importing law into Git, and it would be interesting to follow this project. There's some Icelandic law currently enacted that hasn't been changed since the 1200s. Getting that into Git would be interesting. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 21:25 ` Ævar Arnfjörð Bjarmason @ 2010-08-04 16:38 ` Joel C. Salomon 2010-08-04 19:07 ` Ævar Arnfjörð Bjarmason 2010-08-05 21:37 ` Joel C. Salomon 0 siblings, 2 replies; 36+ messages in thread From: Joel C. Salomon @ 2010-08-04 16:38 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: git On 08/02/2010 05:25 PM, Ævar Arnfjörð Bjarmason wrote: > On Mon, Aug 2, 2010 at 18:32, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >> I'd figured to play with Git in an unusual way: to create a repository >> for the U.S. Constitution where amendments are presented as patches. >> E.g., instead of the First Amendment being placed at the end (as is >> usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). >> Proposed amendments get branches, which get merged in later. > > I'd like to ask where this project is being hosted. I've wanted to > play with importing law into Git, and it would be interesting to > follow this project. It's local to my machine for now, especially since I can't (yet?) get the dates right. Also, I'm rebasing as I tweak the TeX code. Law-into-RCS has been on my mind since I learned out what RCSs are for. Read any bill that the US Congress passes: there's an intro, a whole lot of boilerplate, and then: SEC. 101. EXTENSION OF CHIP. Section 2104(a) (42 U.S.C. 1397dd(a)) is amended-- (1) in paragraph (10), by striking ``and'' at the end; (2) by amending paragraph (11), by striking ``each of fiscal years 2008 and 2009'' and inserting ``fiscal year 2008''; and (3) by adding at the end the following new paragraphs: ``(12) for fiscal year 2009, $10,562,000,000; ``(13) for fiscal year 2010, $12,520,000,000; ``(14) for fiscal year 2011, $13,459,000,000; ``(15) for fiscal year 2012, $14,982,000,000; and ``(16) for fiscal year 2013, for purposes of making 2 semi- annual allotments-- ``(A) $3,000,000,000 for the period beginning on October 1, 2012, and ending on March 31, 2013, and ``(B) $3,000,000,000 for the period beginning on April 1, 2013, and ending on September 30, 2013.''. SEC. 102. ALLOTMENTS FOR STATES AND TERRITORIES FOR FISCAL YEARS 2009 THROUGH 2013. Section 2104 (42 U.S.C. 1397dd) is amended-- (1) in subsection (b)(1), by striking ``subsection (d)'' and inserting ``subsections (d) and (m)''; (2) in subsection (c)(1), by striking ``subsection (d)'' and inserting ``subsections (d) and (m)(4)''; and (3) by adding at the end the following new subsection: .... Sure looks like a patch series to me. > There's some Icelandic law currently enacted that hasn't been changed > since the 1200s. Getting that into Git would be interesting. Extremely. I'll put my Constitution project up on GitHub in a few days. Just note that I *will* rebase and publish. --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-04 16:38 ` Joel C. Salomon @ 2010-08-04 19:07 ` Ævar Arnfjörð Bjarmason 2010-08-05 21:37 ` Joel C. Salomon 1 sibling, 0 replies; 36+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-08-04 19:07 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git On Wed, Aug 4, 2010 at 16:38, Joel C. Salomon <joelcsalomon@gmail.com> wrote: > On 08/02/2010 05:25 PM, Ævar Arnfjörð Bjarmason wrote: >> On Mon, Aug 2, 2010 at 18:32, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>> I'd figured to play with Git in an unusual way: to create a repository >>> for the U.S. Constitution where amendments are presented as patches. >>> E.g., instead of the First Amendment being placed at the end (as is >>> usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). >>> Proposed amendments get branches, which get merged in later. >> >> I'd like to ask where this project is being hosted. I've wanted to >> play with importing law into Git, and it would be interesting to >> follow this project. > > It's local to my machine for now, especially since I can't (yet?) get > the dates right. Also, I'm rebasing as I tweak the TeX code. > > Law-into-RCS has been on my mind since I learned out what RCSs are for. > Read any bill that the US Congress passes: there's an intro, a whole > lot of boilerplate, and then: > > SEC. 101. EXTENSION OF CHIP. > > Section 2104(a) (42 U.S.C. 1397dd(a)) is amended-- > (1) in paragraph (10), by striking ``and'' at the end; > (2) by amending paragraph (11), by striking ``each of > fiscal years 2008 and 2009'' and inserting ``fiscal year > 2008''; and > (3) by adding at the end the following new paragraphs: > ``(12) for fiscal year 2009, $10,562,000,000; > ``(13) for fiscal year 2010, $12,520,000,000; > ``(14) for fiscal year 2011, $13,459,000,000; > ``(15) for fiscal year 2012, $14,982,000,000; and > ``(16) for fiscal year 2013, for purposes of making 2 semi- > annual allotments-- > ``(A) $3,000,000,000 for the period beginning on > October 1, 2012, and ending on March 31, 2013, and > ``(B) $3,000,000,000 for the period beginning on > April 1, 2013, and ending on September 30, 2013.''. > > SEC. 102. ALLOTMENTS FOR STATES AND TERRITORIES FOR FISCAL YEARS 2009 > THROUGH 2013. > > Section 2104 (42 U.S.C. 1397dd) is amended-- > (1) in subsection (b)(1), by striking ``subsection (d)'' > and inserting ``subsections (d) and (m)''; > (2) in subsection (c)(1), by striking ``subsection (d)'' > and inserting ``subsections (d) and (m)(4)''; and > (3) by adding at the end the following new subsection: > .... > > Sure looks like a patch series to me. Yeah, I think every legal system has their own ad-hoc patch convention like that. It can be really hard to figure it all out. Parsing that is non-trivial, but being able to generate diffs based on that would be a very valuable resource. >> There's some Icelandic law currently enacted that hasn't been changed >> since the 1200s. Getting that into Git would be interesting. > > Extremely. > > I'll put my Constitution project up on GitHub in a few days. Just note > that I *will* rebase and publish. Great. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-04 16:38 ` Joel C. Salomon 2010-08-04 19:07 ` Ævar Arnfjörð Bjarmason @ 2010-08-05 21:37 ` Joel C. Salomon 2010-08-05 21:58 ` Ævar Arnfjörð Bjarmason 1 sibling, 1 reply; 36+ messages in thread From: Joel C. Salomon @ 2010-08-05 21:37 UTC (permalink / raw) To: git; +Cc: Ævar Arnfjörð Bjarmason On 08/04/2010 12:38 PM, Joel C. Salomon wrote: > I'll put my Constitution project up on GitHub in a few days. Just note > that I *will* rebase and publish. It's up, at <http://github.com/jcsalomon/constitution>, with one commit. (No amendments yet.) I'm curious to find out if folks with 64-bit time_t get the correct author and commit times. --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-05 21:37 ` Joel C. Salomon @ 2010-08-05 21:58 ` Ævar Arnfjörð Bjarmason 2010-08-05 22:10 ` Sverre Rabbelier 2010-08-06 15:18 ` Joel C. Salomon 0 siblings, 2 replies; 36+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-08-05 21:58 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: > On 08/04/2010 12:38 PM, Joel C. Salomon wrote: >> I'll put my Constitution project up on GitHub in a few days. Just note >> that I *will* rebase and publish. > > It's up, at <http://github.com/jcsalomon/constitution>, with one commit. > (No amendments yet.) > > I'm curious to find out if folks with 64-bit time_t get the correct > author and commit times. On 32bit: commit 826a4f7721fe1c3963a733ecbc5422f05925af5d Author: The Philadelphia Convention <> Date: Wed Dec 31 19:59:59 1969 -0400 On 64bit: commit 826a4f7721fe1c3963a733ecbc5422f05925af5d Author: The Philadelphia Convention <> Date: Mon Sep 17 13:00:00 1787 -0400 It would be useful to turn that into a TODO test for Git. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-05 21:58 ` Ævar Arnfjörð Bjarmason @ 2010-08-05 22:10 ` Sverre Rabbelier 2010-08-06 8:18 ` Jakub Narebski 2010-08-06 15:18 ` Joel C. Salomon 1 sibling, 1 reply; 36+ messages in thread From: Sverre Rabbelier @ 2010-08-05 22:10 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: Joel C. Salomon, git Heya, On Thu, Aug 5, 2010 at 16:58, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On 32bit: > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > Author: The Philadelphia Convention <> > Date: Wed Dec 31 19:59:59 1969 -0400 > > On 64bit: > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > Author: The Philadelphia Convention <> > Date: Mon Sep 17 13:00:00 1787 -0400 > > It would be useful to turn that into a TODO test for Git. That's bad, if we can't store a particular date we should do something about it, not just silently underflow. -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-05 22:10 ` Sverre Rabbelier @ 2010-08-06 8:18 ` Jakub Narebski 2010-08-06 14:01 ` Michael Witten 2010-08-06 15:08 ` Sverre Rabbelier 0 siblings, 2 replies; 36+ messages in thread From: Jakub Narebski @ 2010-08-06 8:18 UTC (permalink / raw) To: Sverre Rabbelier Cc: Ævar Arnfjörð Bjarmason, Joel C. Salomon, git Sverre Rabbelier <srabbelier@gmail.com> writes: > On Thu, Aug 5, 2010 at 16:58, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > > On 32bit: > > > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > > Author: The Philadelphia Convention <> > > Date: Wed Dec 31 19:59:59 1969 -0400 > > > > On 64bit: > > > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > > Author: The Philadelphia Convention <> > > Date: Mon Sep 17 13:00:00 1787 -0400 > > > > It would be useful to turn that into a TODO test for Git. > > That's bad, if we can't store a particular date we should do something > about it, not just silently underflow. We can *store* it without problems, the problem is with *interpretation* by porcelain (and some plumbing). -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 8:18 ` Jakub Narebski @ 2010-08-06 14:01 ` Michael Witten 2010-08-06 15:08 ` Sverre Rabbelier 1 sibling, 0 replies; 36+ messages in thread From: Michael Witten @ 2010-08-06 14:01 UTC (permalink / raw) To: Jakub Narebski Cc: Sverre Rabbelier, Ævar Arnfjörð Bjarmason, Joel C. Salomon, git On Fri, Aug 6, 2010 at 03:18, Jakub Narebski <jnareb@gmail.com> wrote: > the problem is with *interpretation* by > porcelain (and some plumbing). The problem is that git was written with leaky abstractions. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 8:18 ` Jakub Narebski 2010-08-06 14:01 ` Michael Witten @ 2010-08-06 15:08 ` Sverre Rabbelier 1 sibling, 0 replies; 36+ messages in thread From: Sverre Rabbelier @ 2010-08-06 15:08 UTC (permalink / raw) To: Jakub Narebski Cc: Ævar Arnfjörð Bjarmason, Joel C. Salomon, git Heya, On Fri, Aug 6, 2010 at 03:18, Jakub Narebski <jnareb@gmail.com> wrote: > We can *store* it without problems, the problem is with > *interpretation* by porcelain (and some plumbing). That's what I mean though, if the porcelain notices it's trying to read in a date it can't interpret correctly it should warn the user of this fact. -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-05 21:58 ` Ævar Arnfjörð Bjarmason 2010-08-05 22:10 ` Sverre Rabbelier @ 2010-08-06 15:18 ` Joel C. Salomon 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason 2010-08-06 16:44 ` Brandon Casey 1 sibling, 2 replies; 36+ messages in thread From: Joel C. Salomon @ 2010-08-06 15:18 UTC (permalink / raw) To: git; +Cc: Ævar Arnfjörð Bjarmason On Thu, Aug 5, 2010 at 5:58 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >> It's up, at <http://github.com/jcsalomon/constitution>, with one commit. >> >> I'm curious to find out if folks with 64-bit time_t get the correct >> author and commit times. > > On 32bit: > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > Author: The Philadelphia Convention <> > Date: Wed Dec 31 19:59:59 1969 -0400 > > On 64bit: > > commit 826a4f7721fe1c3963a733ecbc5422f05925af5d > Author: The Philadelphia Convention <> > Date: Mon Sep 17 13:00:00 1787 -0400 Cool, it works! (The 13:00 should have been 12:00, but there's some DST weirdness at work.) Can you check what git-fsck has to say about the repos, on 32- & 64-bit machines? --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 15:18 ` Joel C. Salomon @ 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason 2010-08-06 15:29 ` Joel C. Salomon 2010-08-06 16:00 ` Brandon Casey 2010-08-06 16:44 ` Brandon Casey 1 sibling, 2 replies; 36+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-08-06 15:19 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git On Fri, Aug 6, 2010 at 15:18, Joel C. Salomon <joelcsalomon@gmail.com> wrote: > On Thu, Aug 5, 2010 at 5:58 PM, Ævar Arnfjörð Bjarmason > <avarab@gmail.com> wrote: >> On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>> It's up, at <http://github.com/jcsalomon/constitution>, with one commit. >>> >>> I'm curious to find out if folks with 64-bit time_t get the correct >>> author and commit times. >> >> On 32bit: >> >> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >> Author: The Philadelphia Convention <> >> Date: Wed Dec 31 19:59:59 1969 -0400 >> >> On 64bit: >> >> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >> Author: The Philadelphia Convention <> >> Date: Mon Sep 17 13:00:00 1787 -0400 > > Cool, it works! (The 13:00 should have been 12:00, but there's some > DST weirdness at work.) > > Can you check what git-fsck has to say about the repos, on 32- & > 64-bit machines? 32bit says: error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid author/committer line 64 bit doesn't give any warning at all. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason @ 2010-08-06 15:29 ` Joel C. Salomon 2010-08-06 16:00 ` Brandon Casey 1 sibling, 0 replies; 36+ messages in thread From: Joel C. Salomon @ 2010-08-06 15:29 UTC (permalink / raw) To: git Cc: Ævar Arnfjörð Bjarmason, Sverre Rabbelier, Jakub Narebski On Fri, Aug 6, 2010 at 11:19 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On Fri, Aug 6, 2010 at 15:18, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >> Can you check what git-fsck has to say about the repos, on 32- & >> 64-bit machines? > > 32bit says: > > error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid > author/committer line > > 64 bit doesn't give any warning at all. Meanwhile, on Fri, Aug 6, 2010 at 11:08 AM, Sverre Rabbelier <srabbelier@gmail.com> wrote: > On Fri, Aug 6, 2010 at 03:18, Jakub Narebski <jnareb@gmail.com> wrote: >> We can *store* it without problems, the problem is with >> *interpretation* by porcelain (and some plumbing). > > That's what I mean though, if the porcelain notices it's trying to > read in a date it can't interpret correctly it should warn the user of > this fact. Seems the error can be checked for when you ask, but I'd rather not have git complain every time I use constitution.git. Aside: I generated the time stamps with <http://github.com/schwern/y2038>, which may be useful for cross-platform y2038 fixes. --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason 2010-08-06 15:29 ` Joel C. Salomon @ 2010-08-06 16:00 ` Brandon Casey 2010-08-06 16:50 ` Ævar Arnfjörð Bjarmason 1 sibling, 1 reply; 36+ messages in thread From: Brandon Casey @ 2010-08-06 16:00 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: Joel C. Salomon, git Ævar Arnfjörð Bjarmason wrote: > On Fri, Aug 6, 2010 at 15:18, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >> On Thu, Aug 5, 2010 at 5:58 PM, Ævar Arnfjörð Bjarmason >> <avarab@gmail.com> wrote: >>> On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>>> It's up, at <http://github.com/jcsalomon/constitution>, with one commit. >>>> >>>> I'm curious to find out if folks with 64-bit time_t get the correct >>>> author and commit times. >>> On 32bit: >>> >>> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >>> Author: The Philadelphia Convention <> >>> Date: Wed Dec 31 19:59:59 1969 -0400 >>> >>> On 64bit: >>> >>> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >>> Author: The Philadelphia Convention <> >>> Date: Mon Sep 17 13:00:00 1787 -0400 >> Cool, it works! (The 13:00 should have been 12:00, but there's some >> DST weirdness at work.) >> >> Can you check what git-fsck has to say about the repos, on 32- & >> 64-bit machines? > > 32bit says: > > error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid > author/committer line > > 64 bit doesn't give any warning at all. I don't think you're using the latest git. I get this on 64 bit: error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid author/committer line - bad date This is triggered by the negative sign '-' in front of the time field which is not one of 0123456789. See fsck.c line 244. -brandon ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 16:00 ` Brandon Casey @ 2010-08-06 16:50 ` Ævar Arnfjörð Bjarmason 0 siblings, 0 replies; 36+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-08-06 16:50 UTC (permalink / raw) To: Brandon Casey; +Cc: Joel C. Salomon, git On Fri, Aug 6, 2010 at 16:00, Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> wrote: > Ævar Arnfjörð Bjarmason wrote: >> On Fri, Aug 6, 2010 at 15:18, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>> On Thu, Aug 5, 2010 at 5:58 PM, Ævar Arnfjörð Bjarmason >>> <avarab@gmail.com> wrote: >>>> On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>>>> It's up, at <http://github.com/jcsalomon/constitution>, with one commit. >>>>> >>>>> I'm curious to find out if folks with 64-bit time_t get the correct >>>>> author and commit times. >>>> On 32bit: >>>> >>>> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >>>> Author: The Philadelphia Convention <> >>>> Date: Wed Dec 31 19:59:59 1969 -0400 >>>> >>>> On 64bit: >>>> >>>> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >>>> Author: The Philadelphia Convention <> >>>> Date: Mon Sep 17 13:00:00 1787 -0400 >>> Cool, it works! (The 13:00 should have been 12:00, but there's some >>> DST weirdness at work.) >>> >>> Can you check what git-fsck has to say about the repos, on 32- & >>> 64-bit machines? >> >> 32bit says: >> >> error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid >> author/committer line >> >> 64 bit doesn't give any warning at all. > > I don't think you're using the latest git. Guilty as charged. It's a Debian 1.7.1 git. > I get this on 64 bit: > > error in commit 826a4f7721fe1c3963a733ecbc5422f05925af5d: invalid author/committer line - bad date > > This is triggered by the negative sign '-' in front of the time > field which is not one of 0123456789. See fsck.c line 244. > > -brandon > ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 15:18 ` Joel C. Salomon 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason @ 2010-08-06 16:44 ` Brandon Casey 2010-08-08 3:46 ` Joel C. Salomon 1 sibling, 1 reply; 36+ messages in thread From: Brandon Casey @ 2010-08-06 16:44 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git, Ævar Arnfjörð Bjarmason Joel C. Salomon wrote: > On Thu, Aug 5, 2010 at 5:58 PM, Ævar Arnfjörð Bjarmason > <avarab@gmail.com> wrote: >> On Thu, Aug 5, 2010 at 21:37, Joel C. Salomon <joelcsalomon@gmail.com> wrote: >>> It's up, at <http://github.com/jcsalomon/constitution>, with one commit. >>> >>> I'm curious to find out if folks with 64-bit time_t get the correct >>> author and commit times. >> On 32bit: >> >> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >> Author: The Philadelphia Convention <> >> Date: Wed Dec 31 19:59:59 1969 -0400 >> >> On 64bit: >> >> commit 826a4f7721fe1c3963a733ecbc5422f05925af5d >> Author: The Philadelphia Convention <> >> Date: Mon Sep 17 13:00:00 1787 -0400 > > Cool, it works! (The 13:00 should have been 12:00, but there's some > DST weirdness at work.) Something other than the fact that -0400 should be -0500? Or are you talking about an issue with the software you are using to create the dates? -brandon ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-06 16:44 ` Brandon Casey @ 2010-08-08 3:46 ` Joel C. Salomon 2010-08-08 4:11 ` Joshua Juran 0 siblings, 1 reply; 36+ messages in thread From: Joel C. Salomon @ 2010-08-08 3:46 UTC (permalink / raw) To: Brandon Casey; +Cc: git, Ævar Arnfjörð Bjarmason On 08/06/2010 12:44 PM, Brandon Casey wrote: > Joel C. Salomon wrote: >> Cool, it works! (The 13:00 should have been 12:00, but there's some >> DST weirdness at work.) > > Something other than the fact that -0400 should be -0500? No, that's probably it; I'd overlooked the time-zone specifier. Thanks. --Joel ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-08 3:46 ` Joel C. Salomon @ 2010-08-08 4:11 ` Joshua Juran 0 siblings, 0 replies; 36+ messages in thread From: Joshua Juran @ 2010-08-08 4:11 UTC (permalink / raw) To: Joel C. Salomon Cc: Brandon Casey, git, Ævar Arnfjörð Bjarmason On Aug 7, 2010, at 8:46 PM, Joel C. Salomon wrote: > On 08/06/2010 12:44 PM, Brandon Casey wrote: >> Joel C. Salomon wrote: >>> Cool, it works! (The 13:00 should have been 12:00, but there's some >>> DST weirdness at work.) >> >> Something other than the fact that -0400 should be -0500? > > No, that's probably it; I'd overlooked the time-zone specifier. > Thanks. Daylight Saving Time wasn't adopted in the US until 1918, so all Eastern times before then should be displayed as -500, regardless of the time of year. http://en.wikipedia.org/wiki/Daylight_saving_time Josh ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 18:32 Back-dating commits--way back--for constitution.git Joel C. Salomon 2010-08-02 18:34 ` Shawn O. Pearce 2010-08-02 21:25 ` Ævar Arnfjörð Bjarmason @ 2010-08-02 21:48 ` Jakub Narebski 2010-08-02 22:47 ` Junio C Hamano 2010-08-03 8:55 ` Michael J Gruber 2 siblings, 2 replies; 36+ messages in thread From: Jakub Narebski @ 2010-08-02 21:48 UTC (permalink / raw) To: Joel C. Salomon; +Cc: git "Joel C. Salomon" <joelcsalomon@gmail.com> writes: > I'd figured to play with Git in an unusual way: to create a repository > for the U.S. Constitution where amendments are presented as patches. > E.g., instead of the First Amendment being placed at the end (as is > usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). > Proposed amendments get branches, which get merged in later. > > But I'm trying to get the dates right, and I'm missing something. For > example, I made the initial commit with the line > > $ git commit --author="The Philadelphia Convention <>" \ > --date="Mon, 17 Sep 1787 12:00:00 EST" > > but that's not actually setting the commit date to 1787. > > Am I doing something wrong, or is Git (quite reasonably) unable to > accept commit dates that far in the past? Git encodes author and commit (and tagger) time using Unix epoch (POSIX epoch) plus timezone. As Shawn and Ævar wrote on 32-bit systems time_t can cover a range of about 136 years in total around January 1, 1970, which means that the maximum representable time on 32-bit system is 2038-01-19 (the year 2038 problem), but what is more important to you is that minimum representable time is 1901-12-13. 1787 is too old for 32-bit time_t. The headers inside commit (and tag) objects are stored in text form, so they are not limited to 32-bit value. You would have to use system that has 64-bit time_t, or patch git. 64-bit time_t would be enough for everyone (sic!). References: ----------- http://en.wikipedia.org/wiki/Unix_epoch -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 21:48 ` Jakub Narebski @ 2010-08-02 22:47 ` Junio C Hamano 2010-08-03 7:39 ` Jakub Narebski 2010-08-03 8:55 ` Michael J Gruber 1 sibling, 1 reply; 36+ messages in thread From: Junio C Hamano @ 2010-08-02 22:47 UTC (permalink / raw) To: Jakub Narebski; +Cc: Joel C. Salomon, git Jakub Narebski <jnareb@gmail.com> writes: > The headers inside commit (and tag) objects are stored in text form, > so they are not limited to 32-bit value. You would have to use system > that has 64-bit time_t, or patch git. I thought the internal representation of our time was "unsigned long", no? How can you represent anything before Unix epoch? ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 22:47 ` Junio C Hamano @ 2010-08-03 7:39 ` Jakub Narebski 2010-08-03 8:00 ` Jakub Narebski 0 siblings, 1 reply; 36+ messages in thread From: Jakub Narebski @ 2010-08-03 7:39 UTC (permalink / raw) To: Junio C Hamano; +Cc: Joel C. Salomon, git Dnia wtorek 3. sierpnia 2010 00:47, Junio C Hamano napisał: > Jakub Narebski <jnareb@gmail.com> writes: > > > The headers inside commit (and tag) objects are stored in text form, > > so they are not limited to 32-bit value. You would have to use system > > that has 64-bit time_t, or patch git. > > I thought the internal representation of our time was "unsigned long", no? > How can you represent anything before Unix epoch? time_t is signed long. Besides, git uses textual representation, its just a matter of putting minus sign. We can always fall back to low level git-hash-object. I'm just not sure if 'git commit' can work with dates prior to Unix epoch. I guess that git has some sanity checks that flies in the face of such ab)use of git. Refrences: ========== [1] time(p) manpage [2] http://en.wikipedia.org/wiki/Unix_epoch#Representing_the_number [3] http://en.wikipedia.org/wiki/Time_t -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 7:39 ` Jakub Narebski @ 2010-08-03 8:00 ` Jakub Narebski 0 siblings, 0 replies; 36+ messages in thread From: Jakub Narebski @ 2010-08-03 8:00 UTC (permalink / raw) To: Junio C Hamano; +Cc: Joel C. Salomon, git Dnia wtorek 3. sierpnia 2010 09:39, Jakub Narebski napisał: > Dnia wtorek 3. sierpnia 2010 00:47, Junio C Hamano napisał: > > Jakub Narebski <jnareb@gmail.com> writes: > > > > > The headers inside commit (and tag) objects are stored in text form, > > > so they are not limited to 32-bit value. You would have to use system > > > that has 64-bit time_t, or patch git. > > > > I thought the internal representation of our time was "unsigned long", no? > > How can you represent anything before Unix epoch? > > time_t is signed long. Besides, git uses textual representation, its > just a matter of putting minus sign. We can always fall back to > low level git-hash-object. And it works: $ git show commit a5f4eaace56c6887846ea77725e1ac6827bb13b0 Author: Jakub Narebski <jnareb@gmail.com> Date: Fri May 31 18:24:20 1929 +0200 git-hash-object $ git cat-file -p HEAD tree 953e0e451fdcb5c21a25ee7ef9faade5791b95ee parent 6a28c9c996d785b716559f57149a9b5c11fd83ff author Jakub Narebski <jnareb@gmail.com> -1280820940 +0200 committer Jakub Narebski <jnareb@gmail.com> 1280820940 +0200 git-hash-object -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-02 21:48 ` Jakub Narebski 2010-08-02 22:47 ` Junio C Hamano @ 2010-08-03 8:55 ` Michael J Gruber 2010-08-03 9:32 ` Joshua Juran 2010-08-03 10:02 ` Jakub Narebski 1 sibling, 2 replies; 36+ messages in thread From: Michael J Gruber @ 2010-08-03 8:55 UTC (permalink / raw) To: Jakub Narebski; +Cc: Joel C. Salomon, git, Junio C Hamano Jakub Narebski venit, vidit, dixit 02.08.2010 23:48: > "Joel C. Salomon" <joelcsalomon@gmail.com> writes: > >> I'd figured to play with Git in an unusual way: to create a repository >> for the U.S. Constitution where amendments are presented as patches. >> E.g., instead of the First Amendment being placed at the end (as is >> usual) I'm putting it in Article 1, Section 9 (Limitations of Congress). >> Proposed amendments get branches, which get merged in later. >> >> But I'm trying to get the dates right, and I'm missing something. For >> example, I made the initial commit with the line >> >> $ git commit --author="The Philadelphia Convention <>" \ >> --date="Mon, 17 Sep 1787 12:00:00 EST" >> >> but that's not actually setting the commit date to 1787. >> >> Am I doing something wrong, or is Git (quite reasonably) unable to >> accept commit dates that far in the past? > > Git encodes author and commit (and tagger) time using Unix epoch > (POSIX epoch) plus timezone. As Shawn and Ævar wrote on 32-bit > systems time_t can cover a range of about 136 years in total around > January 1, 1970, which means that the maximum representable time on > 32-bit system is 2038-01-19 (the year 2038 problem), but what is more > important to you is that minimum representable time is 1901-12-13. > 1787 is too old for 32-bit time_t. > > The headers inside commit (and tag) objects are stored in text form, > so they are not limited to 32-bit value. You would have to use system > that has 64-bit time_t, or patch git. Hmm, sizeof(time_t) == 8 for my x86_64 Fedora, but committing ancient times fails. My ctime() happily converts negative numbers into dates before the epoch. > > 64-bit time_t would be enough for everyone (sic!). > > References: > ----------- > http://en.wikipedia.org/wiki/Unix_epoch Junio replied: >I thought the internal representation of our time was "unsigned long", >no? >How can you represent anything before Unix epoch? We have a mix of time_t and unsigned long (not signed, not long long!), and we have our own tm_to_time_t() in date.c which explicitly forbids years before 1970. It seems we don't use standard ctime() and friends because the standards is not so standard and want to be independent of that, but sizeof(long) is still system dependent. Removing the check in tm_to_time_t() by brute force let's me commit ancient times, but the parser gets them wrong (either on input or on output, I haven't checked), 1787 ends up output as 1899. time_t is signed on most systems. Using unsigned long buys us a few years as long as we don't go through any system routine nor conversion to time_t. So maybe we should: - check to make sure we use time_t and system routines only when getting the current time - use signed long long as our git_time_t (I think long is less system dependent then long but I could be wrong) - make our own algorithms work for the extended format Michael ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 8:55 ` Michael J Gruber @ 2010-08-03 9:32 ` Joshua Juran 2010-08-03 12:44 ` Jeff King 2010-08-03 10:02 ` Jakub Narebski 1 sibling, 1 reply; 36+ messages in thread From: Joshua Juran @ 2010-08-03 9:32 UTC (permalink / raw) To: Michael J Gruber; +Cc: Jakub Narebski, Joel C. Salomon, git, Junio C Hamano On Aug 3, 2010, at 1:55 AM, Michael J Gruber wrote: > Jakub Narebski venit, vidit, dixit 02.08.2010 23:48: > >> The headers inside commit (and tag) objects are stored in text form, >> so they are not limited to 32-bit value. You would have to use >> system >> that has 64-bit time_t, or patch git. >> >> 64-bit time_t would be enough for everyone (sic!). > > time_t is signed on most systems. Using unsigned long buys us a few > years as long as we don't go through any system routine nor conversion > to time_t. So maybe we should: > > - check to make sure we use time_t and system routines only when > getting > the current time > - use signed long long as our git_time_t (I think long is less system > dependent then long but I could be wrong) Obviously you mean "I think long long is less system dependent than long". Does any system exist where long long is not 64 bits? In any case, you can future-proof it by spelling it "int64_t". That symbol is not guaranteed to exist (nor is <stdint.h>), but neither is the long long type in the first place. > - make our own algorithms work for the extended format This would enable systems with 32-bit time_t to deal with pre-1901 commit timestamps in Git.[1] Hopefully such systems will become increasingly rare. Josh [1] Or post-2038 timestamps, but any use case for such is dubious. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 9:32 ` Joshua Juran @ 2010-08-03 12:44 ` Jeff King 2010-08-03 17:37 ` Joshua Juran 0 siblings, 1 reply; 36+ messages in thread From: Jeff King @ 2010-08-03 12:44 UTC (permalink / raw) To: Joshua Juran Cc: Michael J Gruber, Jakub Narebski, Joel C. Salomon, git, Junio C Hamano On Tue, Aug 03, 2010 at 02:32:06AM -0700, Joshua Juran wrote: > >- use signed long long as our git_time_t (I think long is less system > >dependent then long but I could be wrong) > > Obviously you mean "I think long long is less system dependent than > long". > > Does any system exist where long long is not 64 bits? In any case, > you can future-proof it by spelling it "int64_t". That symbol is not > guaranteed to exist (nor is <stdint.h>), but neither is the long long > type in the first place. C99 specifies that "short" and "int" be at least 16 bits, that "long" be at least 32 bits, and that "long long" be at least 64 bits. See section 5.2.4.2.1. -Peff ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 12:44 ` Jeff King @ 2010-08-03 17:37 ` Joshua Juran 2010-08-03 17:49 ` Jeff King 0 siblings, 1 reply; 36+ messages in thread From: Joshua Juran @ 2010-08-03 17:37 UTC (permalink / raw) To: Jeff King Cc: Michael J Gruber, Jakub Narebski, Joel C. Salomon, git, Junio C Hamano On Aug 3, 2010, at 5:44 AM, Jeff King wrote: > On Tue, Aug 03, 2010 at 02:32:06AM -0700, Joshua Juran wrote: > >>> - use signed long long as our git_time_t (I think long is less >>> system >>> dependent then long but I could be wrong) >> >> Obviously you mean "I think long long is less system dependent than >> long". >> >> Does any system exist where long long is not 64 bits? In any case, >> you can future-proof it by spelling it "int64_t". That symbol is not >> guaranteed to exist (nor is <stdint.h>), but neither is the long long >> type in the first place. > > C99 specifies that "short" and "int" be at least 16 bits, that > "long" be > at least 32 bits, and that "long long" be at least 64 bits. See > section > 5.2.4.2.1. Right, but there's no guarantee that long long won't be *larger* than 64 bits. Though maybe that wouldn't be a problem. Josh ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 17:37 ` Joshua Juran @ 2010-08-03 17:49 ` Jeff King 0 siblings, 0 replies; 36+ messages in thread From: Jeff King @ 2010-08-03 17:49 UTC (permalink / raw) To: Joshua Juran Cc: Michael J Gruber, Jakub Narebski, Joel C. Salomon, git, Junio C Hamano On Tue, Aug 03, 2010 at 10:37:26AM -0700, Joshua Juran wrote: > >>Does any system exist where long long is not 64 bits? In any case, > >>you can future-proof it by spelling it "int64_t". That symbol is not > >>guaranteed to exist (nor is <stdint.h>), but neither is the long long > >>type in the first place. > > > >C99 specifies that "short" and "int" be at least 16 bits, that > >"long" be > >at least 32 bits, and that "long long" be at least 64 bits. See > >section > >5.2.4.2.1. > > Right, but there's no guarantee that long long won't be *larger* than > 64 bits. Though maybe that wouldn't be a problem. Ah, I took your statement to mean "at least". In this case, I don't think it would be a problem (we could just represent more times). -Peff ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 8:55 ` Michael J Gruber 2010-08-03 9:32 ` Joshua Juran @ 2010-08-03 10:02 ` Jakub Narebski 2010-08-03 10:08 ` Jakub Narebski 2010-08-03 12:48 ` Jeff King 1 sibling, 2 replies; 36+ messages in thread From: Jakub Narebski @ 2010-08-03 10:02 UTC (permalink / raw) To: Michael J Gruber; +Cc: Joel C. Salomon, git, Junio C Hamano On Tue, 3 Aug 2010, Michael J Gruber wrote: > Jakub Narebski venit, vidit, dixit 02.08.2010 23:48: >> "Joel C. Salomon" <joelcsalomon@gmail.com> writes: >>> [...] I'm trying to get the dates right, and I'm missing something. For >>> example, I made the initial commit with the line >>> >>> $ git commit --author="The Philadelphia Convention <>" \ >>> --date="Mon, 17 Sep 1787 12:00:00 EST" >>> >>> but that's not actually setting the commit date to 1787. >>> >>> Am I doing something wrong, or is Git (quite reasonably) unable to >>> accept commit dates that far in the past? >> >> Git encodes author and commit (and tagger) time using Unix epoch >> (POSIX epoch) plus timezone. As Shawn and Ævar wrote on 32-bit >> systems time_t can cover a range of about 136 years in total around >> January 1, 1970, which means that the maximum representable time on >> 32-bit system is 2038-01-19 (the year 2038 problem), but what is more >> important to you is that minimum representable time is 1901-12-13. >> 1787 is too old for 32-bit time_t. >> >> The headers inside commit (and tag) objects are stored in text form, >> so they are not limited to 32-bit value. You would have to use system >> that has 64-bit time_t, or patch git. > > Hmm, sizeof(time_t) == 8 for my x86_64 Fedora, but committing ancient > times fails. That's because git *porcelain* either does not use time_t consistently, or has some sanity checks that are good heuristic for ordinary use (like e.g. commit time not too far in past where git didn't even exists), or both. It is not a problem on lowest level, i.e. repository format and plumbing. I was able to create a commit that had author time before Unix epoch using plumbing: 1. create an ordinary commit as a template (so I don't have to go down to the level of gitcore-tutorial: $ git commit -a [master 8ddcf60] foo 1 files changed, 1 insertions(+), 0 deletions(-) 2. save commit object in a file, to be edited $ git cat-file -p HEAD > tmp.txt 3. edit tmp.txt, changing sign of author time $ [edit tmp.txt] $ cat tmp.txt tree 953e0e451fdcb5c21a25ee7ef9faade5791b95ee parent 6a28c9c996d785b716559f57149a9b5c11fd83ff author Jakub Narebski <jnareb@gmail.com> -12808209400 +0200 committer Jakub Narebski <jnareb@gmail.com> 1280820940 +0200 git-hash-object 4. replace just created commit by handcrafted one $ git reset --hard HEAD^ $ git hash-object -t commit -w tmp.txt fa5e5a2b6f27f10ce920ca82ffef07ed3eb3f26f $ git update-ref -m 'commit: foo' refs/heads/master \ fa5e5a2b6f27f10ce920ca82ffef07ed3eb3f26f 5. check that porcelain parses date correctly $ git show commit a5f4eaace56c6887846ea77725e1ac6827bb13b0 Author: Jakub Narebski <jnareb@gmail.com> Date: Fri May 31 18:24:20 1929 +0200 git-hash-object Though when I tried to create commit with authordate further in the past, porcelain shown 1970 (Unix epoch) as a date, but my system has 32-bit time_t. > My ctime() happily converts negative numbers into dates before the epoch. Try ./test-date in git sources... > Junio replied: >> >> I thought the internal representation of our time was "unsigned long",>no? >> How can you represent anything before Unix epoch? > > We have a mix of time_t and unsigned long (not signed, not long long!), > and we have our own tm_to_time_t() in date.c which explicitly forbids > years before 1970. It seems we don't use standard ctime() and friends > because the standards is not so standard and want to be independent of > that, but sizeof(long) is still system dependent. > > Removing the check in tm_to_time_t() by brute force let's me commit > ancient times, but the parser gets them wrong (either on input or on > output, I haven't checked), 1787 ends up output as 1899. Hmmm... -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 10:02 ` Jakub Narebski @ 2010-08-03 10:08 ` Jakub Narebski 2010-08-03 12:48 ` Jeff King 1 sibling, 0 replies; 36+ messages in thread From: Jakub Narebski @ 2010-08-03 10:08 UTC (permalink / raw) To: Michael J Gruber; +Cc: Joel C. Salomon, git, Junio C Hamano Jakub Narebski wrote: > 3. edit tmp.txt, changing sign of author time > > $ [edit tmp.txt] > $ cat tmp.txt > tree 953e0e451fdcb5c21a25ee7ef9faade5791b95ee > parent 6a28c9c996d785b716559f57149a9b5c11fd83ff > author Jakub Narebski <jnareb@gmail.com> -12808209400 +0200 Errr... wrong file copy'n'pasted. It was author Jakub Narebski <jnareb@gmail.com> -1280820940 +0200 > committer Jakub Narebski <jnareb@gmail.com> 1280820940 +0200 -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 10:02 ` Jakub Narebski 2010-08-03 10:08 ` Jakub Narebski @ 2010-08-03 12:48 ` Jeff King 2010-08-03 13:19 ` Jakub Narebski 1 sibling, 1 reply; 36+ messages in thread From: Jeff King @ 2010-08-03 12:48 UTC (permalink / raw) To: Jakub Narebski; +Cc: Michael J Gruber, Joel C. Salomon, git, Junio C Hamano On Tue, Aug 03, 2010 at 12:02:52PM +0200, Jakub Narebski wrote: > > Hmm, sizeof(time_t) == 8 for my x86_64 Fedora, but committing ancient > > times fails. > > That's because git *porcelain* either does not use time_t consistently, > or has some sanity checks that are good heuristic for ordinary use (like > e.g. commit time not too far in past where git didn't even exists), > or both. > > It is not a problem on lowest level, i.e. repository format and plumbing. > I was able to create a commit that had author time before Unix epoch > using plumbing: I am not sure there isn't some unportability at the lowest level. We freely interchange between time_t and unsigned long in the low-level date code. It probably happens to work because casting the bits back and forth between signed and unsigned types generally works, as long as you end up with the type that you want. But it isn't necessarily portable, and there can be subtle bugs. See, for example, my recent 9ba0f033. -Peff ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 12:48 ` Jeff King @ 2010-08-03 13:19 ` Jakub Narebski 2010-08-03 13:20 ` Jeff King 0 siblings, 1 reply; 36+ messages in thread From: Jakub Narebski @ 2010-08-03 13:19 UTC (permalink / raw) To: Jeff King; +Cc: Michael J Gruber, Joel C. Salomon, git, Junio C Hamano On Tue, 3 Aug 2010, Jeff King wrote: > On Tue, Aug 03, 2010 at 12:02:52PM +0200, Jakub Narebski wrote: > > > > Hmm, sizeof(time_t) == 8 for my x86_64 Fedora, but committing ancient > > > times fails. > > > > That's because git *porcelain* either does not use time_t consistently, > > or has some sanity checks that are good heuristic for ordinary use (like > > e.g. commit time not too far in past where git didn't even exists), > > or both. > > > > It is not a problem on lowest level, i.e. repository format and plumbing. > > I was able to create a commit that had author time before Unix epoch > > using plumbing: > > I am not sure there isn't some unportability at the lowest level. We > freely interchange between time_t and unsigned long in the low-level > date code. It probably happens to work because casting the bits back and > forth between signed and unsigned types generally works, as long as you > end up with the type that you want. But it isn't necessarily portable, > and there can be subtle bugs. See, for example, my recent 9ba0f033. Well, at least there is not a problem at lowest of low, i.e. repository format level, thanks to the use of textual representation for epoch. -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 13:19 ` Jakub Narebski @ 2010-08-03 13:20 ` Jeff King 2010-08-03 13:24 ` Michael J Gruber 0 siblings, 1 reply; 36+ messages in thread From: Jeff King @ 2010-08-03 13:20 UTC (permalink / raw) To: Jakub Narebski; +Cc: Michael J Gruber, Joel C. Salomon, git, Junio C Hamano On Tue, Aug 03, 2010 at 03:19:09PM +0200, Jakub Narebski wrote: > > I am not sure there isn't some unportability at the lowest level. We > > freely interchange between time_t and unsigned long in the low-level > > date code. It probably happens to work because casting the bits back and > > forth between signed and unsigned types generally works, as long as you > > end up with the type that you want. But it isn't necessarily portable, > > and there can be subtle bugs. See, for example, my recent 9ba0f033. > > Well, at least there is not a problem at lowest of low, i.e. repository > format level, thanks to the use of textual representation for epoch. Yes, the good news that this is purely a code problem. The data format is fine. It would just take somebody going through the code and switching all "unsigned long" to "long long" (or time_t, or even "gittime_t" if we want to abstract it). -Peff ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 13:20 ` Jeff King @ 2010-08-03 13:24 ` Michael J Gruber 2010-08-03 13:32 ` Jeff King 0 siblings, 1 reply; 36+ messages in thread From: Michael J Gruber @ 2010-08-03 13:24 UTC (permalink / raw) To: Jeff King; +Cc: Jakub Narebski, Joel C. Salomon, git, Junio C Hamano Jeff King venit, vidit, dixit 03.08.2010 15:20: > On Tue, Aug 03, 2010 at 03:19:09PM +0200, Jakub Narebski wrote: > >>> I am not sure there isn't some unportability at the lowest level. We >>> freely interchange between time_t and unsigned long in the low-level >>> date code. It probably happens to work because casting the bits back and >>> forth between signed and unsigned types generally works, as long as you >>> end up with the type that you want. But it isn't necessarily portable, >>> and there can be subtle bugs. See, for example, my recent 9ba0f033. >> >> Well, at least there is not a problem at lowest of low, i.e. repository >> format level, thanks to the use of textual representation for epoch. > > Yes, the good news that this is purely a code problem. The data format > is fine. It would just take somebody going through the code and > switching all "unsigned long" to "long long" (or time_t, or even > "gittime_t" if we want to abstract it). ...and fixing the parser algorithm at least in tm_to_time_t()... Michael ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: Back-dating commits--way back--for constitution.git 2010-08-03 13:24 ` Michael J Gruber @ 2010-08-03 13:32 ` Jeff King 0 siblings, 0 replies; 36+ messages in thread From: Jeff King @ 2010-08-03 13:32 UTC (permalink / raw) To: Michael J Gruber; +Cc: Jakub Narebski, Joel C. Salomon, git, Junio C Hamano On Tue, Aug 03, 2010 at 03:24:17PM +0200, Michael J Gruber wrote: > > Yes, the good news that this is purely a code problem. The data format > > is fine. It would just take somebody going through the code and > > switching all "unsigned long" to "long long" (or time_t, or even > > "gittime_t" if we want to abstract it). > > ...and fixing the parser algorithm at least in tm_to_time_t()... Yeah, I should have been more clear. It is _not_ just "sed s/unsigned long/long long", but rather checking every change to make sure that you aren't introducing new bugs, and that the code correctly handles signed types. Which is why nobody has done it. ;) -Peff ^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2010-08-08 4:11 UTC | newest] Thread overview: 36+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-02 18:32 Back-dating commits--way back--for constitution.git Joel C. Salomon 2010-08-02 18:34 ` Shawn O. Pearce 2010-08-02 18:41 ` Joel C. Salomon 2010-08-02 21:25 ` Ævar Arnfjörð Bjarmason 2010-08-04 16:38 ` Joel C. Salomon 2010-08-04 19:07 ` Ævar Arnfjörð Bjarmason 2010-08-05 21:37 ` Joel C. Salomon 2010-08-05 21:58 ` Ævar Arnfjörð Bjarmason 2010-08-05 22:10 ` Sverre Rabbelier 2010-08-06 8:18 ` Jakub Narebski 2010-08-06 14:01 ` Michael Witten 2010-08-06 15:08 ` Sverre Rabbelier 2010-08-06 15:18 ` Joel C. Salomon 2010-08-06 15:19 ` Ævar Arnfjörð Bjarmason 2010-08-06 15:29 ` Joel C. Salomon 2010-08-06 16:00 ` Brandon Casey 2010-08-06 16:50 ` Ævar Arnfjörð Bjarmason 2010-08-06 16:44 ` Brandon Casey 2010-08-08 3:46 ` Joel C. Salomon 2010-08-08 4:11 ` Joshua Juran 2010-08-02 21:48 ` Jakub Narebski 2010-08-02 22:47 ` Junio C Hamano 2010-08-03 7:39 ` Jakub Narebski 2010-08-03 8:00 ` Jakub Narebski 2010-08-03 8:55 ` Michael J Gruber 2010-08-03 9:32 ` Joshua Juran 2010-08-03 12:44 ` Jeff King 2010-08-03 17:37 ` Joshua Juran 2010-08-03 17:49 ` Jeff King 2010-08-03 10:02 ` Jakub Narebski 2010-08-03 10:08 ` Jakub Narebski 2010-08-03 12:48 ` Jeff King 2010-08-03 13:19 ` Jakub Narebski 2010-08-03 13:20 ` Jeff King 2010-08-03 13:24 ` Michael J Gruber 2010-08-03 13:32 ` Jeff King
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).