{"thread":{"id":"20786","subject":"git-svn messing up merge commits on dcommit","startedAt":"2009-08-30T01:32:25Z","lastAt":"2009-08-31T01:37:39Z","messageCount":2,"participants":["Björn Steinbrink","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"122093","messageId":"20090830013225.GA6475@atjola.homenet","threadId":"20786","inReplyTo":null,"subject":"git-svn messing up merge commits on dcommit","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-08-30T01:32:25Z","receivedAt":"2009-08-30T01:32:25Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"Hi Eric,\n\nI have two \"test cases\" here (attached), which I actually wrote months\nago, but forgot to sent, as I wanted to clean them up/turn them into\nsomething suitable for the test suite, but honestly, I'll probably never\nget around to do that, so here they are, as they are. They show git-svn\nmessing up merge commits when dcommitting a branch that is not\nup-to-date WRT the svn repo.\n\nThe basic history for both cases (before dcommit) is:\n\n        C---D (master)\n       /   /\n      /---E (side)\n     /\nA---B (trunk)\n     \\\n      X (revision in SVN, not yet fetched)\n\nSo the dcommit (which would send C and D to the svn repo) needs to\n\"rebase\" C and D.\n\nIn the first test case, this rebasing causes conflicts, and leads to a\nlinearized history:\n\n      E (side)\n     /\nA---B---X---C' (trunk)\n             \\\n              D (master)\n\nThe merge is broken apart. This is probably expected, but I thought I'd\ntell anyway.\n\n\nThe second test case is a bit more interesting, there are no conflicts\nbetween the local commits to be dcommitted and the new commit X in the\nsvn repo. In this case, git-svn manages to dcommit the merge commit just\nfine, keeping the history correct, but it messes the merge commit's\ncommit message up. So the history becomes:\n\nA---B---X---C'--D' (trunk) (master)\n     \\         /\n      --------E (side)\n\nBut D' has the same commit message as C/C', not the one from D.\n\nI hope that makes any sense to you (or you can figure it out from the\ntesting scripts).\n\nBjörn\n\n\n#!/bin/sh\nmkdir git-svn-test\ncd git-svn-test\n\nSVN=\"file://$PWD/svnrepo\"\nsvnadmin create svnrepo\nsvn co \"$SVN\" co\ncd co\nsvn mkdir trunk tags branches\nsvn ci -m init\n\necho 123 > trunk/foo\nsvn add trunk/foo\nsvn ci -m \"SVN 1\"\n\ncd ..\n\ngit svn clone -s \"$SVN\" git\n\ncd co\necho 456 >> trunk/foo\nsvn ci -m \"SVN 2\"\ncd ..\n\ncd git\ngit checkout -b side\necho 123 >> foo\ngit add foo\ngit commit -m \"On side\"\ngit checkout master\necho 123 > foo3\ngit add foo3\ngit commit -m \"On master\"\ngit merge --no-ff side\ngitk --all&\ngit svn dcommit\necho resolved > foo\ngit add -u\ngit rebase --continue\ngitk --all\n\n\n#!/bin/sh\nmkdir git-svn-test\ncd git-svn-test\n\nSVN=\"file://$PWD/svnrepo\"\nsvnadmin create svnrepo\nsvn co \"$SVN\" co\ncd co\nsvn mkdir trunk tags branches\nsvn ci -m init\n\necho 123 > trunk/foo\nsvn add trunk/foo\nsvn ci -m \"SVN 1\"\n\ncd ..\n\ngit svn clone -s \"$SVN\" git\n\ncd co\necho 456 >> trunk/foo\nsvn ci -m \"SVN 2\"\ncd ..\n\ncd git\ngit checkout -b side\necho 123 >> foo2\ngit add foo2\ngit commit -m \"On side\"\ngit checkout master\necho 123 > foo3\ngit add foo3\ngit commit -m \"On master\"\ngit merge --no-ff side\ngitk --all&\ngit svn dcommit\ngitk --all&\n"},{"id":"122153","messageId":"20090831013739.GA30367@dcvr.yhbt.net","threadId":"20786","inReplyTo":"20090830013225.GA6475@atjola.homenet","subject":"Re: git-svn messing up merge commits on dcommit","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-08-31T01:37:39Z","receivedAt":"2009-08-31T01:37:39Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Björn Steinbrink <B.Steinbrink@gmx.de> wrote:\n> Hi Eric,\n> \n> I have two \"test cases\" here (attached), which I actually wrote months\n> ago, but forgot to sent, as I wanted to clean them up/turn them into\n> something suitable for the test suite, but honestly, I'll probably never\n> get around to do that, so here they are, as they are. They show git-svn\n> messing up merge commits when dcommitting a branch that is not\n> up-to-date WRT the svn repo.\n> \n> The basic history for both cases (before dcommit) is:\n> \n>         C---D (master)\n>        /   /\n>       /---E (side)\n>      /\n> A---B (trunk)\n>      \\\n>       X (revision in SVN, not yet fetched)\n> \n> So the dcommit (which would send C and D to the svn repo) needs to\n> \"rebase\" C and D.\n> \n> In the first test case, this rebasing causes conflicts, and leads to a\n> linearized history:\n> \n>       E (side)\n>      /\n> A---B---X---C' (trunk)\n>              \\\n>               D (master)\n> \n> The merge is broken apart. This is probably expected, but I thought I'd\n> tell anyway.\n\nAs noted in the CAVEATS section of the manpage, pull/merge isn't\nrecommended with dcommit because it generates non-linear history.\n\nKeep in mind this was written before SVN got merge tracking support, but\nI haven't been particularly motivated to revisit the topic since then...\n\n> I hope that makes any sense to you (or you can figure it out from the\n> testing scripts).\n\nThanks for posting these, though.  They do seem to be good test cases\nfor developing on and hopefully somebody with more interest in\nthis topic can pick up where we leave off.\n\nOn a side note, I have been meaning to refactor git svn and break it\napart into separate Perl modules for easier hacking for the longest time\nnow...\n\n-- \nEric Wong\n"}]}