{"thread":{"id":"13430","subject":"How to (re-)create .git/logs/refs","startedAt":"2008-05-08T10:56:11Z","lastAt":"2008-05-13T13:50:10Z","messageCount":10,"participants":["Holger Schurig","Nicolas Pitre","Andreas Ericsson","Johannes Schindelin","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"76367","messageId":"200805081256.11465.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":null,"subject":"How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-08T10:56:11Z","receivedAt":"2008-05-08T10:56:11Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"Hi !\n\nI have an old SVN project with lots of commits from 2005 to 2008\nconverted. This was a month ago. In the mean-time, I've made\nsome commits from git as well.\n\n\"git log\" shows both types of commit quite nicely.\n\n\"git checkout <sha1>\" works also correctly, for arbitrary ancient\nSHA1s.\n\n\"git checkout @{2007-04-01}\" doesn't work. I get an error like\nthis:\n\n  warning: Log for '' only goes back to Thu, 8 May 2008 09:35:38 +0000.\n  fatal: bad object @{2007-04-01}\n\nHowever, \"git checkout @{2008-05-01}\" works, because this commit\nwas a git commit, not an SVN-converted one. It seems that\nneiver \"git svn clone\" nor \"examples/git-svnimport.perl\"\ncreates/updates .git/logs/refs and that therefore @{date} is\nuseless here.\n\n\nSo my question:\n\na) is there a way to re-create .git/logs/refs ?\n\nb) is there a simple way to get a list of ISO-dates and\n   associated SHA1?  Then I could use a little python code to\n   determine the SHA1 id that corresponds to some date (I need\n   to access old versions of the source via bitbake and/or\n   www.openembedded.org, so adding a custom fetch method with\n   some python magic is a non-brainer).\n\nc) any plan to fix git-svn?\n"},{"id":"76368","messageId":"200805081428.35732.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":"200805081256.11465.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-08T12:28:35Z","receivedAt":"2008-05-08T12:28:35Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":">   warning: Log for '' only goes back to Thu, 8 May 2008\n> 09:35:38 +0000. fatal: bad object @{2007-04-01}\n\nOops, this was from another test that I made today. My original\ngit repository shows of course a different date:\n\n  warning: Log for '' only goes back to Wed, 23 Apr 2008 08:36:26 +0200.\n  fatal: bad object @{2007-05-01}\n\nAlso, \"git log @{2007-05-01}\" | cat  gives me this error\nmessage, \"git checkout @{2007-05-01}\" gives\n\n  error: pathspec '@{2007-05-01}' did not match any file(s) known to git.\n  Did you forget to 'git add'?\n\nwhich is completely misleading.\n\n\n\nSorry for being unclear in my first mail.\n"},{"id":"76387","messageId":"alpine.LFD.1.10.0805081313190.23581@xanadu.home","threadId":"13430","inReplyTo":"200805081256.11465.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2008-05-08T17:28:50Z","receivedAt":"2008-05-08T17:28:50Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Thu, 8 May 2008, Holger Schurig wrote:\n\n> So my question:\n> \n> a) is there a way to re-create .git/logs/refs ?\n\nNo.\n\nThe reflog records how _you_ modified your various branches locally.  \nThis has no direct relationship with the dates the commits in those \nbranches were created.  It records what was your own view of the \nrepository in time.  So if you performed an import of a SVN repository \nlast week, then it is normal that you don't have any view into that \nparticular repository's state before last week.\n\n> b) is there a simple way to get a list of ISO-dates and\n>    associated SHA1?  Then I could use a little python code to\n>    determine the SHA1 id that corresponds to some date (I need\n>    to access old versions of the source via bitbake and/or\n>    www.openembedded.org, so adding a custom fetch method with\n>    some python magic is a non-brainer).\n\nHave a look at the documentation for the --pretty=format option in the \ngit-log man page.  For example:\n\n\tgit log --pretty=format:\"%H %ai\"\n\nmight be just what you're looking for.\n\n\nNicolas\n"},{"id":"76837","messageId":"200805130842.06112.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":"alpine.LFD.1.10.0805081313190.23581@xanadu.home","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-13T06:42:06Z","receivedAt":"2008-05-13T06:42:06Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"> > a) is there a way to re-create .git/logs/refs ?\n>\n> No.\n>\n> The reflog records how _you_ modified your various branches\n> locally.\n\nOkay, then I presume it's a shortcoming that the @{date} syntax \nuses .git/logs/ref. It could do otherwise, e.g. git bisect seems \nto able to go via bisection arbitrarily back in time without \nusing log-refs.\n\n> \tgit log --pretty=format:\"%H %ai\"\n\nThanks.\n"},{"id":"76851","messageId":"200805131111.42517.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":"200805130842.06112.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-13T09:11:42Z","receivedAt":"2008-05-13T09:11:42Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"> Okay, then I presume it's a shortcoming that the @{date}\n> syntax uses .git/logs/ref.\n\nIs there any reason sha1_name.c (which is responsible for the @{} \nsyntax) doesn't include list-objects.h and uses \ntraverse_commit_list() for it's purposes?  It wouldn't then need \nto use .git/logs/ref anymore.\n\nIf that would be ok, then maybe I find time (in my spare time) \nand prepare a patch in this direction.\n"},{"id":"76854","messageId":"4829619E.4020701@op5.se","threadId":"13430","inReplyTo":"200805131111.42517.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-05-13T09:38:38Z","receivedAt":"2008-05-13T09:38:38Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Holger Schurig wrote:\n>> Okay, then I presume it's a shortcoming that the @{date}\n>> syntax uses .git/logs/ref.\n> \n> Is there any reason sha1_name.c (which is responsible for the @{} \n> syntax) doesn't include list-objects.h and uses \n> traverse_commit_list() for it's purposes?\n\n\nIt would be alot slower for large projects. Otoh it would also mean\nit'd work on a freshly cloned repository, so perhaps it's worth\nthe trade-off.\n\n\n>  It wouldn't then need \n> to use .git/logs/ref anymore.\n> \n> If that would be ok, then maybe I find time (in my spare time) \n> and prepare a patch in this direction.\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"76862","messageId":"alpine.DEB.1.00.0805131244300.30431@racer","threadId":"13430","inReplyTo":"200805130842.06112.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-05-13T11:46:57Z","receivedAt":"2008-05-13T11:46:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 13 May 2008, Holger Schurig wrote:\n\n> > > a) is there a way to re-create .git/logs/refs ?\n> >\n> > No.\n> >\n> > The reflog records how _you_ modified your various branches\n> > locally.\n> \n> Okay, then I presume it's a shortcoming that the @{date} syntax \n> uses .git/logs/ref.\n\nAre you sure you understand what @{date} does?  It shows you the state \n_this_ repository was in at that date.\n\nThere is _no way_ to get this information from somewhere else than the \nreflogs.\n\nIt is a common misconception that you can reference anything by date in a \ndistributed setup.  (Before you ask, I will just mention \"clock skew\" and \n\"parallel branches\" to give you an idea why this is a misconception.)\n\nCiao,\nDscho\n"},{"id":"76866","messageId":"200805131413.14753.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":"alpine.DEB.1.00.0805131244300.30431@racer","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-13T12:13:14Z","receivedAt":"2008-05-13T12:13:14Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"> Are you sure you understand what @{date} does?  It shows you\n> the state _this_ repository was in at that date.\n\nWho says so?  \"man git-rev-parse\" just says:\n\no  A ref followed by the suffix @ with a date specification\n   enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3\n   days 1 hour 1 second ago} or {1979-02-26 18:30:00}) to specify\n   the value of the ref at a prior point in time. This suffix may\n   only be used immediately following a ref name and the ref\n   must have an existing log ($GIT_DIR/logs/<ref>).\n\n\nIt just states \"at a prior point in time\", not \"at a prior point \nin time in your git repository/checkout\".\n\n\n> It is a common misconception that you can reference anything\n> by date in a distributed setup.  (Before you ask, I will just\n> mention \"clock skew\" and \"parallel branches\" to give you an\n> idea why this is a misconception.)\n\nMy idea was to use the first commit (from git-rev-log) where the \ndate is below the specified date.\n\nTo give you some context: Bitbake (from www.openembedded.org) is \na tool that can download software, patch it, configure it, \ncompile it and create packages out of it. Nothing fancy, except \nthat it can do this for a huge amount of embedded devices, \nusually using a cross-compiler for ARM, MIPS, whatever.\n\nAnd it can download not just tar files, it can also use CVS, SVN, \nhg, git and so on.\n\nIn Openembedded, many patch recipes specify the version to use. \nIf you deal with versioned stuff, e.g. \nfilename-frob-3.14.tar.bz, this is fine. Sometimes the version \nis a SVN revision number. And sometimes it's a git, mercury or \nmonotone hash. However, the latter beast are almost \nnon-describing. So many bitbake recipes specify a SRCDATE, and \nyou can immediately see if SRCDATE=20070501 that it uses an \nancient version of the software, from 1st May 2007. You won't \nsee that if it would specify \nGIT_REV=6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4. Of course you \ncan do\n\n  GIT_REV=6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4\n  # This is from 2007 May 1st\n\nbut then you're redundant and chances are high that those two \nlines get out-of-sync.\n\n\nSo, when I have SRCDATE=20070501, I'd be happy if git would, for \nme, find out that this is \n6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4, even when the commit \n6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4 was not done on my \nlocal machine, but is a commit that I pulled from the outside.\n\nAlso, when I do \"git checkout @{20070501}\", I don't usually mind \nif, e.g. because of time-skew or multi-heads, I'm not at the \n17th commit in this area, but on the top-most for which this \ncondition is true. I can use \"git log\" and \"git reset\" or \nwhatever to dig my way to the state I want, but git would do the \ndull work for me.\n"},{"id":"76870","messageId":"m33aom5oc2.fsf@localhost.localdomain","threadId":"13430","inReplyTo":"200805131413.14753.hs4233@mail.mn-solutions.de","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-05-13T13:24:34Z","receivedAt":"2008-05-13T13:24:34Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Holger Schurig <hs4233@mail.mn-solutions.de> writes:\n\n> > Are you sure you understand what @{date} does?  It shows you\n> > the state _this_ repository was in at that date.\n> \n> Who says so? \"man git-rev-parse\" just says:\n> \n> o  A ref followed by the suffix @ with a date specification\n>    enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3\n>    days 1 hour 1 second ago} or {1979-02-26 18:30:00}) to specify\n>    the value of the ref at a prior point in time. This suffix may\n>    only be used immediately following a ref name and the ref\n>    must have an existing log ($GIT_DIR/logs/<ref>).\n> \n> It just states \"at a prior point in time\", not \"at a prior point \n> in time in your git repository/checkout\".\n\nPlease read carefully: \"value of the _ref_\" at a given time.\nIt means value where ref pointed to at given time.  That of\ncourse depends on what you did with repository: did you just fetch,\nor perhaps you made those commits, or perhaps you rebased branch,\nor decided that the work you did is wrong and rewound to previous\nversion using reset.\n\nAs this is purely local matter, it matter only for _your_\nrepository.\n\n> > It is a common misconception that you can reference anything\n> > by date in a distributed setup.  (Before you ask, I will just\n> > mention \"clock skew\" and \"parallel branches\" to give you an\n> > idea why this is a misconception.)\n> \n> My idea was to use the first commit (from git-rev-log) where the \n> date is below the specified date.\n\nWhich might be not what you want, as you can get revision which\nwas on some side branch.\n \n> To give you some context: Bitbake (from www.openembedded.org) is \n> a tool that can download software, patch it, configure it, \n> compile it and create packages out of it. Nothing fancy, except \n> that it can do this for a huge amount of embedded devices, \n> usually using a cross-compiler for ARM, MIPS, whatever.\n>\n> And it can download not just tar files, it can also use CVS, SVN, \n> hg, git and so on.\n> \n> In OpenEmbedded, many patch recipes specify the version to use. \n> If you deal with versioned stuff, e.g. \n> filename-frob-3.14.tar.bz, this is fine. Sometimes the version \n> is a SVN revision number. And sometimes it's a git, mercury or \n> monotone hash. However, the latter beast are almost \n> non-describing. So many bitbake recipes specify a SRCDATE, and \n> you can immediately see if SRCDATE=20070501 that it uses an \n> ancient version of the software, from 1st May 2007. You won't \n> see that if it would specify \n> GIT_REV=6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4. Of course you \n> can do\n> \n>   GIT_REV=6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4\n>   # This is from 2007 May 1st\n> \n> but then you're redundant and chances are high that those two \n> lines get out-of-sync.\n \nThanks for explanation.  This is most useful when proposing solutions\nto real problem...\n\nThe solution, of course, is to use git-describe output instead of\nfull SHA-1 (this of course assumes that you tag your releases).\nSomething like \"v1.5.5.1-215-gc853afb\" is, I think, quite well\nself-described.  There is still place for ambiguity due without\nthe shortened sha-1 part due to parallel development, but I think\nno less than using date.\n \n> So, when I have SRCDATE=20070501, I'd be happy if git would, for \n> me, find out that this is \n> 6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4, even when the commit \n> 6e2df4fd066c450b0b3c8e0f1769d4163e2b52c4 was not done on my \n> local machine, but is a commit that I pulled from the outside.\n> \n> Also, when I do \"git checkout @{20070501}\", I don't usually mind \n> if, e.g. because of time-skew or multi-heads, I'm not at the \n> 17th commit in this area, but on the top-most for which this \n> condition is true. I can use \"git log\" and \"git reset\" or \n> whatever to dig my way to the state I want, but git would do the \n> dull work for me.\n\nYou can try \n\n $ git checkout \"$(git log -1 --pretty=format:%H --before=2007-05-01)\"\n\nbut YMMV, i.e. if you hit upon correct revision or not would depend\non luck.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"76872","messageId":"200805131550.10834.hs4233@mail.mn-solutions.de","threadId":"13430","inReplyTo":"m33aom5oc2.fsf@localhost.localdomain","subject":"Re: How to (re-)create .git/logs/refs","fromName":"Holger Schurig","fromEmail":"hs4233@mail.mn-solutions.de","sentAt":"2008-05-13T13:50:10Z","receivedAt":"2008-05-13T13:50:10Z","isPatch":false,"sender":{"key":"hs4233@mail.mn-solutions.de","avatar":null},"body":"Hi Jakub !\n\nThanks for your trick. That completely solves my problem *)\n\n\n\n*) I'm fully aware that that \"git log\" might show something like:\n\n2 days ago: Blah\n3 days ago: Muh\n3 days ago: Blech\n2 days ago: Huwa!\n\nBut this won't happen in my case --- at least not in repositories \nfreshly converted from SVN.\n"}]}