{"thread":{"id":"4752","subject":"git-cvsimport gets parents wrong for branches","startedAt":"2006-07-03T21:53:03Z","lastAt":"2006-07-04T11:33:43Z","messageCount":6,"participants":["Elrond","Martin Langhoff","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"23147","messageId":"20060703215303.GA24572@memak.tu-darmstadt.de","threadId":"4752","inReplyTo":null,"subject":"git-cvsimport gets parents wrong for branches","fromName":"Elrond","fromEmail":"elrond+kernel.org@samba-tng.org","sentAt":"2006-07-03T21:53:03Z","receivedAt":"2006-07-03T21:53:03Z","isPatch":false,"sender":{"key":"elrond+kernel.org@samba-tng.org","avatar":null},"body":"\nHi,\n\nJust by accident I noticed, that git-cvsimport got the\nparents for branches wrong in one of my projects.\n\nTo assist in debugging this, I've made up a testcase script\n(appended to this mail).\nIt will create a new cvs-repo, put 4 commits in it,\nand finally run gitk to investigate it.\n\nIt should look something like this:\n\n    4 [branch-stable-fixes] commit-on-branch\n  3 | [master] [origin] commit-master-after-branch\n  |/\n  2   [tag-branchpoint] commit-first-edit\n  1   commit-base\n\nWhat it really looks like:\n\n  4   ..\n  3   ..\n  2   ..\n  1   ..\n\n4's parent is 3, not (as it should) 2.\n\n\nI've tested with 1.4.0 and the current git-cvsimport from\n8fced61.\n\nI hope the testcase helps tracking the problem down.\n\n\n    Elrond\n\np.s.: The testcase script is not nice. It just does the\n      job, nothing more.\n"},{"id":"23154","messageId":"46a038f90607031615m2cafbf05q5922fb04eae72362@mail.gmail.com","threadId":"4752","inReplyTo":"20060703215303.GA24572@memak.tu-darmstadt.de","subject":"Re: git-cvsimport gets parents wrong for branches","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2006-07-03T23:15:47Z","receivedAt":"2006-07-03T23:15:47Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"Elrond,\n\nyou are right, the current git-cvsimport takes a very naive approach\nto determine where branches open from. It uses cvsps internally, which\nonly reports on the ancestor branch, so we take the latest commit from\nthe ancestor.\n\nParsecvs probably has a more sophisticated approach, have you tried it?\n\nIt is pretty hard to get that one right in any case, as there are\ncases where the new branch starts from something that is not a commit\nin the parent (from GIT's perspective). So representing the branching\npoint would mean pointing to non-existing commits as parents.\n\nIf the cvs2svn documentation is not lying, it probably has the\nsmartest/correctest implementation. For small-medium repos, you may be\nable to run cvs2svn and then import with git-svnimport.\n\ncheers,\n\n\nmartin\n"},{"id":"23198","messageId":"Pine.LNX.4.63.0607041007391.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4752","inReplyTo":"46a038f90607031615m2cafbf05q5922fb04eae72362@mail.gmail.com","subject":"Re: git-cvsimport gets parents wrong for branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-04T08:09:18Z","receivedAt":"2006-07-04T08:09:18Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 4 Jul 2006, Martin Langhoff wrote:\n\n> It is pretty hard to get that one right in any case, as there are\n> cases where the new branch starts from something that is not a commit\n> in the parent (from GIT's perspective).\n\nBut it should be easy to introduce a faked commit, which just contains \nthose versions (and takes the newest commit touching any of these file \nversions as branch point).\n\nCiao,\nDscho\n"},{"id":"23208","messageId":"20060704104631.GB24572@memak.tu-darmstadt.de","threadId":"4752","inReplyTo":"46a038f90607031615m2cafbf05q5922fb04eae72362@mail.gmail.com","subject":"Re: git-cvsimport gets parents wrong for branches","fromName":"Elrond","fromEmail":"elrond@samba-tng.org","sentAt":"2006-07-04T10:46:31Z","receivedAt":"2006-07-04T10:46:31Z","isPatch":false,"sender":{"key":"elrond@samba-tng.org","avatar":null},"body":"On Tue, Jul 04, 2006 at 11:15:47AM +1200, Martin Langhoff wrote:\n> Elrond,\n> \n> you are right, the current git-cvsimport takes a very naive approach\n> to determine where branches open from. It uses cvsps internally, which\n> only reports on the ancestor branch, so we take the latest commit from\n> the ancestor.\n\nIf there is no fix visible, it probably should be\ndocumented, that git-cvsimport isn't the perfect solution,\nso people aren't surprised.\n\n\n> Parsecvs probably has a more sophisticated approach, have you tried it?\n\nAfter finding the current correct git:-url [1] for it, I\nnoticed, that I need libgit for it (I use git from my\ndistribution), so I've postponed this.\nOf course, you can use my script and try parsecvs yourself.\n\n\n> If the cvs2svn documentation is not lying, it probably has the\n> smartest/correctest implementation. For small-medium repos, you may be\n> able to run cvs2svn and then import with git-svnimport.\n\nI'll try that soon.\n\n\n    Elrond\n\n[1] git://anongit.freedesktop.org/git/users/keithp/parsecvs\n"},{"id":"23210","messageId":"20060704110313.GC24572@memak.tu-darmstadt.de","threadId":"4752","inReplyTo":"Pine.LNX.4.63.0607041007391.29667@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: git-cvsimport gets parents wrong for branches","fromName":"Elrond","fromEmail":"elrond+kernel.org@samba-tng.org","sentAt":"2006-07-04T11:03:14Z","receivedAt":"2006-07-04T11:03:14Z","isPatch":false,"sender":{"key":"elrond+kernel.org@samba-tng.org","avatar":null},"body":"On Tue, Jul 04, 2006 at 10:09:18AM +0200, Johannes Schindelin wrote:\n> Hi,\n> \n> On Tue, 4 Jul 2006, Martin Langhoff wrote:\n> \n> > It is pretty hard to get that one right in any case, as there are\n> > cases where the new branch starts from something that is not a commit\n> > in the parent (from GIT's perspective).\n> \n> But it should be easy to introduce a faked commit, which just contains \n> those versions (and takes the newest commit touching any of these file \n> versions as branch point).\n\nOf couye in theory, (if cvs was used sanely), the base of\neach branch should be a commit on the parent-branch. But as\nwe all know, cvs allows pathologic cases.\n(My script doesn't create such a case, it's sanely\nrepresentable in git without any fake commits.)\n\n\nSo now for the patholigic cases (when they're solved, the\nmain issue is solved too):\n\nOf course, the base version for a branch can be turned into\na tree (should be easy: cvsps's first changeset of the\nbranch has the previous revisions of each file).\nThis tree can also be turned into a fake commit...\njust which parent should our new fake commit have?\n\nMy current simple answer is: The commit on the parent\nbranch with the most matching number of files, so that\nthe diff, that the fake commit introduces has the least\nnumber of files.\n\nIn the non-patholoc case, the fake commit would introduce\nno diff at all and should be dropped.\n\nOf couse I have no idea, how hard it would be to implement\nthis. And in reality, it would be cvsps's job to do that.\n\n\n    Elrond\n"},{"id":"23217","messageId":"Pine.LNX.4.63.0607041330120.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4752","inReplyTo":"20060704110313.GC24572@memak.tu-darmstadt.de","subject":"Re: git-cvsimport gets parents wrong for branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-04T11:33:43Z","receivedAt":"2006-07-04T11:33:43Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 4 Jul 2006, Elrond wrote:\n\n> On Tue, Jul 04, 2006 at 10:09:18AM +0200, Johannes Schindelin wrote:\n> > Hi,\n> > \n> > On Tue, 4 Jul 2006, Martin Langhoff wrote:\n> > \n> > > It is pretty hard to get that one right in any case, as there are\n> > > cases where the new branch starts from something that is not a commit\n> > > in the parent (from GIT's perspective).\n> > \n> > But it should be easy to introduce a faked commit, which just contains \n> > those versions (and takes the newest commit touching any of these file \n> > versions as branch point).\n> \n> [...]\n>\n> just which parent should our new fake commit have?\n\nThat is what I tried to address with the \"branch point\" thing. Just take \nthe newest commit (in the ancestor line) touching the file versions of \nthat particular tree, or in other words, the oldest commit having at least \nthese file versions.\n\nIMHO it is dumb enough not to branch off of a commit that it does not \nmatter that much what parent this faked commit has.\n\nCiao,\nDscho\n"}]}