{"thread":{"id":"8394","subject":"git-svn adding too many blank lines during git-cherry-pick, and git-cherry getting confused","startedAt":"2007-06-02T04:50:07Z","lastAt":"2007-06-05T10:24:49Z","messageCount":2,"participants":["Robin H. Johnson","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"43786","messageId":"20070602045007.GJ27013@curie-int.orbis-terrarum.net","threadId":"8394","inReplyTo":null,"subject":"git-svn adding too many blank lines during git-cherry-pick, and git-cherry getting confused","fromName":"Robin H. Johnson","fromEmail":"robbat2@gentoo.org","sentAt":"2007-06-02T04:50:07Z","receivedAt":"2007-06-02T04:50:07Z","isPatch":false,"sender":{"key":"robbat2@gentoo.org","avatar":"https://avatars.githubusercontent.com/u/373898?v=4"},"body":"Hi,\n\nBit of weirdness I ran into.\n\nI have a SVN tree, with a branch that gets some backported fixe (they\nusually apply cleanly).\n\nI commit the fix to the trunk + git-svn dcommit, and then switch to the\nother branch, and git-cherry-pick the fix.\n\nFor git-svn commits, the log has:\nOn the trunk side, there is a two blank line before git-svn-id.\nOn the branch side, there are three blank lines before git-svn-id.\nIf I cherry-pick from that branch to a third branch, I get 4 blank\nlines.\n\nFor regular SVN commits, the log has:\nOnly a single blank line before git-svn-id.\n\nI think the source of the problem is that git-svn-id is being removed\nwhen cherry-picking, but NOT the leading blank line.\n\nThis all leads to the hashes of the commits diverging badly, and then\ngit-cherry gets very confused when asked to compare the trunk vs. the\nbranches.\n\nHow do we solve it?\nThis is only on a conceptual level here, looking at the present state of\ngit-svn, I'm not sure how best to solve it.\n\ngit-svn fetch:\n1. Get commit message from SVN. \n2. Trim ALL trailing blank lines (and existing git-svn-id lines).\n3. If the last line was header-style (Signed-off-by, CC, etc)\n3.1. if it was, do not add a blank line.\n3.2. If not, add a single blank line.\n4. Insert git-svn-id header.\n\ngit-svn dcommit:\n1. Get commit message (git cat-file commit ....)\n2. Remove the git-svn-id line.\n3. Remove all trailing blank lines.\n4. Commit.\n\n-- \nRobin Hugh Johnson\nGentoo Linux Developer & Council Member\nE-Mail     : robbat2@gentoo.org\nGnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85\n"},{"id":"44058","messageId":"20070605102449.GB12948@muzzle","threadId":"8394","inReplyTo":"20070602045007.GJ27013@curie-int.orbis-terrarum.net","subject":"Re: git-svn adding too many blank lines during git-cherry-pick, and git-cherry getting confused","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-05T10:24:49Z","receivedAt":"2007-06-05T10:24:49Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Robin H. Johnson\" <robbat2@gentoo.org> wrote:\n> Hi,\n> \n> Bit of weirdness I ran into.\n> \n> I have a SVN tree, with a branch that gets some backported fixe (they\n> usually apply cleanly).\n> \n> I commit the fix to the trunk + git-svn dcommit, and then switch to the\n> other branch, and git-cherry-pick the fix.\n> \n> For git-svn commits, the log has:\n> On the trunk side, there is a two blank line before git-svn-id.\n> On the branch side, there are three blank lines before git-svn-id.\n> If I cherry-pick from that branch to a third branch, I get 4 blank\n> lines.\n> \n> For regular SVN commits, the log has:\n> Only a single blank line before git-svn-id.\n> \n> I think the source of the problem is that git-svn-id is being removed\n> when cherry-picking, but NOT the leading blank line.\n> \n> This all leads to the hashes of the commits diverging badly, and then\n> git-cherry gets very confused when asked to compare the trunk vs. the\n> branches.\n> \n> How do we solve it?\n> This is only on a conceptual level here, looking at the present state of\n> git-svn, I'm not sure how best to solve it.\n> \n> git-svn fetch:\n> 1. Get commit message from SVN. \n> 2. Trim ALL trailing blank lines (and existing git-svn-id lines).\n> 3. If the last line was header-style (Signed-off-by, CC, etc)\n> 3.1. if it was, do not add a blank line.\n> 3.2. If not, add a single blank line.\n> 4. Insert git-svn-id header.\n\nToo much magic.  I don't think this is a good idea, at least\nnot by default.\n\n> git-svn dcommit:\n> 1. Get commit message (git cat-file commit ....)\n> 2. Remove the git-svn-id line.\n> 3. Remove all trailing blank lines.\n> 4. Commit.\n\nWe already do step 3.  The problem is that we fail to remove the newline\n*before* the git-svn-id line.  I'll make a mental note to fix this\nsometime this week, I hope.\n\n-- \nEric Wong\n"}]}