{"thread":{"id":"17243","subject":"parent-filter loses my merged branch -- what am I doing wrong?","startedAt":"2009-01-19T03:45:35Z","lastAt":"2009-01-20T20:05:30Z","messageCount":3,"participants":["Ask Bjørn Hansen","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101090","messageId":"7578B9A6-BF81-4096-B0FD-F433AD62A41E@develooper.com","threadId":"17243","inReplyTo":null,"subject":"parent-filter loses my merged branch -- what am I doing wrong?","fromName":"Ask Bjørn Hansen","fromEmail":"ask@develooper.com","sentAt":"2009-01-19T03:45:35Z","receivedAt":"2009-01-19T03:45:35Z","isPatch":false,"sender":{"key":"ask@develooper.com","avatar":"https://gravatar.com/avatar/05ce68433216df7d04bb0d82b7d93b11957e2137e6ed23c4b5bc061d78635f2f?d=mp&s=160"},"body":"Hi everyone,\n\nI'm converting another svn repository to git (yay).  It's only about  \n1000 commits, but over more than 7 years and a cvs->svn conversion.\n\nOn Sam Villain's recommendation I'm spending a bit of time cleaning up  \nthe branches and merges with git filter-branch, but I don't think I'm  \nquite understanding how it's supposed to work.\n\nI put the repository up here (about 1MB):\n\tgit clone git://git.develooper.com/qpsmtpd.git\n\nI started out making a temporary tag for each svn commit, to have  \neasier to use reference points:\n\nfor c in `git rev-list --all --date-order --timestamp | sort -n | awk  \n'{print $2}'`; do\n   svnid=`git show -s $c | tail -1 | sed 's/.*svn.perl.org\\/qpsmtpd \n\\///' | sed 's/\\ .*//' | sed 's/^branches\\///'`\n   git tag -f $svnid $c\ndone\n\nThen I tried getting the first merge adjusted to show both parents.     \nThe commit tagged v010@56 should be the second parent for trunk@57  \n(the original/other parent for trunk@57 is trunk@20).\n\nI tried using:\n\ngit filter-branch --tag-name-filter cat --parent-filter '\n                  if test $GIT_COMMIT = $(git rev-parse trunk@57)\n                  then\n                     echo \"-p $(git rev-parse trunk@20) -p $(git rev- \nparse v010@56)\"\n                  else\n                     cat\n                  fi\n         ' \\\nmaster\n\n...  but that seems to just basically throw away the \"v010\" branch!   \nWhat did I do wrong?  (Some of the other problems with this repository  \nis that we moved the branches around with \"svn mv\", so some of the  \nbranches don't even have the branch point as a parent; but I'll get  \nback to that when I get this simple case working).\n\n(The script also loses all the temporary tags I added; I thought \"-- \ntag-name-filter cat\" would preserve them?)\n\n\n  - ask\n\n-- \nhttp://develooper.com/ - http://askask.com/\n"},{"id":"101111","messageId":"49743CB7.4030300@viscovery.net","threadId":"17243","inReplyTo":"7578B9A6-BF81-4096-B0FD-F433AD62A41E@develooper.com","subject":"Re: parent-filter loses my merged branch -- what am I doing wrong?","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-01-19T08:41:27Z","receivedAt":"2009-01-19T08:41:27Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Ask Bjørn Hansen schrieb:\n> On Sam Villain's recommendation I'm spending a bit of time cleaning up\n> the branches and merges with git filter-branch, but I don't think I'm\n> quite understanding how it's supposed to work.\n\nDon't use --parent-filter for this; use grafts. You can see the history in\ngitk right away. Later run filter-branch without a filter (except perhaps\nthe tag-name-filter).\n\n-- Hannes\n"},{"id":"101290","messageId":"EA6D5B1E-DA22-4E57-86B6-A192090FCE53@develooper.com","threadId":"17243","inReplyTo":"49743CB7.4030300@viscovery.net","subject":"Re: parent-filter loses my merged branch -- what am I doing wrong?","fromName":"Ask Bjørn Hansen","fromEmail":"ask@develooper.com","sentAt":"2009-01-20T20:05:30Z","receivedAt":"2009-01-20T20:05:30Z","isPatch":false,"sender":{"key":"ask@develooper.com","avatar":"https://gravatar.com/avatar/05ce68433216df7d04bb0d82b7d93b11957e2137e6ed23c4b5bc061d78635f2f?d=mp&s=160"},"body":"\nOn Jan 19, 2009, at 0:41, Johannes Sixt wrote:\n\n> Ask Bjørn Hansen schrieb:\n>> On Sam Villain's recommendation I'm spending a bit of time cleaning  \n>> up\n>> the branches and merges with git filter-branch, but I don't think I'm\n>> quite understanding how it's supposed to work.\n>\n> Don't use --parent-filter for this; use grafts. You can see the  \n> history in\n> gitk right away. Later run filter-branch without a filter (except  \n> perhaps\n> the tag-name-filter).\n\nAha - excellent.  I didn't understand clearly from the documentation  \nthat they'd be \"written in stone\" by filter-branch.  Building the  \ngrafts with .git/info/grafts was much much easier.\n\n\n   - ask\n\n-- \nhttp://develooper.com/ - http://askask.com/\n"}]}