{"thread":{"id":"12034","subject":"problem with git rebase -i","startedAt":"2008-02-11T13:44:48Z","lastAt":"2008-02-13T10:10:13Z","messageCount":4,"participants":["Uwe Kleine-König"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"68391","messageId":"20080211134448.GA17588@digi.com","threadId":"12034","inReplyTo":null,"subject":"problem with git rebase -i","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-02-11T13:44:48Z","receivedAt":"2008-02-11T13:44:48Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nI tried to rebase my work (on the Linux kernel) to current Linus'\nmaster.  As I have two branches I merged them and ran:\n\n\tgit rebase -i -p v2.6.25-rc1\n\nBut then the list I got in my editor didn't include the merge and so the\nresult was broken.\n\nIf I add\n\n\tpick 913183f\n\n(with 913183f being my HEAD) to the list, the result is correct.\n\nThe reason that my merge is missing is that git rev-list thinks my\nmerge is the same as 249d621 and so skips that as it uses --cherry-pick.\n\nCurrently I cannot reproduce that with a simple testcase.\nI don't want to publish my tree now, but I can provide a bundle if\nsomeone wants to look into that.\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König, Software Engineer\nDigi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany\nTax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962\n"},{"id":"68607","messageId":"20080213081059.GA18230@digi.com","threadId":"12034","inReplyTo":"20080211134448.GA17588@digi.com","subject":"Re: problem with git rebase -i","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-02-13T08:10:59Z","receivedAt":"2008-02-13T08:10:59Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nUwe Kleine-König wrote:\n> I tried to rebase my work (on the Linux kernel) to current Linus'\n> master.  As I have two branches I merged them and ran:\n> \n> \tgit rebase -i -p v2.6.25-rc1\n> \n> But then the list I got in my editor didn't include the merge and so the\n> result was broken.\n> \n> If I add\n> \n> \tpick 913183f\n> \n> (with 913183f being my HEAD) to the list, the result is correct.\n> \n> The reason that my merge is missing is that git rev-list thinks my\n> merge is the same as 249d621 and so skips that as it uses --cherry-pick.\nI think the right thing to do here is to let --cherry-pick only kick out\nrevs that are no merges.  This should be save as git-rebase--interactive\nis the only user of --cherry-pick.\n\nComments?\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König, Software Engineer\nDigi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany\nTax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962\n"},{"id":"68620","messageId":"20080213092910.GA20219@digi.com","threadId":"12034","inReplyTo":"20080213081059.GA18230@digi.com","subject":"Re: problem with git rebase -i","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-02-13T09:29:10Z","receivedAt":"2008-02-13T09:29:10Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\n> Uwe Kleine-König wrote:\n> > I tried to rebase my work (on the Linux kernel) to current Linus'\n> > master.  As I have two branches I merged them and ran:\n> > \n> > \tgit rebase -i -p v2.6.25-rc1\n> > \n> > But then the list I got in my editor didn't include the merge and so the\n> > result was broken.\n> > \n> > If I add\n> > \n> > \tpick 913183f\n> > \n> > (with 913183f being my HEAD) to the list, the result is correct.\n> > \n> > The reason that my merge is missing is that git rev-list thinks my\n> > merge is the same as 249d621 and so skips that as it uses --cherry-pick.\n> I think the right thing to do here is to let --cherry-pick only kick out\n> revs that are no merges.  This should be save as git-rebase--interactive\n> is the only user of --cherry-pick.\nAfter some debugging I found the problem.\n\nI created 913183f with\n\n\tgit merge --no-ff -s ours branch1 branch2\n\nwhile HEAD was on an ancestor of v2.6.25-rc1.  As patch_id uses the diff\nto the first parent the result was the id of an empty patch.\nAs 249d621 is empty, too, 913183f was skipped.\n\n@Len: The log message of 249d621 suggests that this should be a merge,\nbut it only has one parent.  Did you lost some commits here?\n\nI didn't try it, but I assume that if I hadn't used --no-ff to create\n913183f it would have worked.\n\nNonetheless I think that kicking out 913183f is wrong.  In my eyes the\nfix must result in \n\n\tpatch-id(913183f) != patch-id(249d621)\n\nSo probably the combined diff should be used to calculate the patch id?\n\nI don't understand the git code here, but I will provide a test in a\nfollow-up mail.\n\nBest regards\nUwe\n\n-- \nUwe Kleine-König, Software Engineer\nDigi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany\nTax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962\n"},{"id":"68622","messageId":"1202897413-7762-1-git-send-email-Uwe.Kleine-Koenig@digi.com","threadId":"12034","inReplyTo":"20080213092910.GA20219@digi.com","subject":"[PATCH] new test: rev-list --cherry-pick excludes an empty commit against a superseding merge","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-02-13T10:10:13Z","receivedAt":"2008-02-13T10:10:13Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Currently rev-list --cherry-pick kicks out two commits if they introduce the\nsame change to their first parent and ignores other parents.  This can be bad\nif both sides used the ours strategy to supersede old development branches.\n\nSigned-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>\n---\n t/t6007-rev-list-cherry-pick-file.sh |   14 +++++++++++++-\n 1 files changed, 13 insertions(+), 1 deletions(-)\n\nHello,\n\nI'm not sure if combined diff is the right term.  I'm open for a better\none.\n\nMoreover I'm not happy with the shortlog, maybe someone has a better\nsuggestion?\n\ndiff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh\nindex 4b8611c..26f62e1 100755\n--- a/t/t6007-rev-list-cherry-pick-file.sh\n+++ b/t/t6007-rev-list-cherry-pick-file.sh\n@@ -29,7 +29,13 @@ test_expect_success setup '\n \tgit checkout branch foo &&\n \ttest_tick &&\n \tgit commit -m \"B\" &&\n-\tgit tag B\n+\tgit tag B &&\n+\ttest_tick &&\n+\tgit checkout -b emptymerge A &&\n+\tgit merge --no-ff -s ours master branch &&\n+\ttest_tick &&\n+\tgit checkout -b empty A &&\n+\tgit commit --allow-empty -m empty\n '\n \n test_expect_success '--cherry-pick foo comes up empty' '\n@@ -54,4 +60,10 @@ test_expect_success '--cherry-pick with independent, but identical branches' '\n \t\tHEAD...master -- foo)\"\n '\n \n+# don't kick out commits c1, c2 with diff c1 c1^ == diff c2 c2^ but \n+# with different combined diffs\n+test_expect_failure '--cherry-pick with a superseding merge and an empty commit' '\n+\ttest \"4\" == \"$(git rev-list --cherry-pick empty...emptymerge | wc -l)\"\n+'\n+\n test_done\n-- \n1.5.4\n"}]}