{"thread":{"id":"29612","subject":"[BUG] git-merge-octopus creates an empty merge commit with one parent","startedAt":"2012-02-13T11:48:56Z","lastAt":"2012-02-13T20:53:12Z","messageCount":5,"participants":["Michał Kiedrowicz","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"184563","messageId":"1329133736-20817-1-git-send-email-michal.kiedrowicz@gmail.com","threadId":"29612","inReplyTo":null,"subject":"[BUG] git-merge-octopus creates an empty merge commit with one parent","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2012-02-13T11:48:56Z","receivedAt":"2012-02-13T11:48:56Z","isPatch":false,"sender":{"key":"michal.kiedrowicz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14072847?v=4"},"body":"This happens when git merge is run to merge multiple commits that are\ndescendants of current HEAD (or are HEAD).  We've hit this while updating master\nto origin/master but accidentaly we called (while being on master):\n\n\t$ git merge master origin/master\n\nHere is a minimal testcase:\n\n\t$ git init a\n\n\t$ cd a\n\n\t$ echo a>a\n\n\t$ git commit -minitial\n\n\t$ echo b>a\n\n\t$ git add a\n\n\t$ git commit -msecond\n\n\t$ git checkout master^\n\n\t$ git merge master master\n\tFast-forwarding to: master\n\tAlready up-to-date with master\n\tMerge made by the 'octopus' strategy.\n\t a |    2 +-\n\t  1 files changed, 1 insertions(+), 1 deletions(-)\n\n\t$ git cat-file commit HEAD\n\ttree eebfed94e75e7760540d1485c740902590a00332\n\tparent bd679e85202280b263e20a57639a142fa14c2c64\n\tauthor Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 1329132996 +0100\n\tcommitter Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 1329132996 +0100\n\n\tMerge branches 'master' and 'master' into HEAD\n\n... and below is a patch that adds a testcase to Git's testsuite.\n\nI would expect `git merge master master` to just 'Fast forward'.\n\nSigned-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>\n---\n t/t6028-merge-up-to-date.sh |   17 ++++++++++++++++-\n 1 files changed, 16 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t6028-merge-up-to-date.sh b/t/t6028-merge-up-to-date.sh\nindex a91644e..824fca5 100755\n--- a/t/t6028-merge-up-to-date.sh\n+++ b/t/t6028-merge-up-to-date.sh\n@@ -16,7 +16,12 @@ test_expect_success setup '\n \ttest_tick &&\n \tgit commit -m second &&\n \tgit tag c1 &&\n-\tgit branch test\n+\tgit branch test &&\n+\techo third >file &&\n+\tgit add file &&\n+\ttest_tick &&\n+\tgit commit -m third &&\n+\tgit tag c2\n '\n \n test_expect_success 'merge -s recursive up-to-date' '\n@@ -74,4 +79,14 @@ test_expect_success 'merge -s subtree up-to-date' '\n \n '\n \n+test_expect_failure 'merge fast-forward octopus' '\n+\n+\tgit reset --hard c0 &&\n+\ttest_tick &&\n+\tgit merge c1 c2\n+\texpect=$(git rev-parse c2) &&\n+\tcurrent=$(git rev-parse HEAD) &&\n+\ttest \"$expect\" = \"$current\"\n+'\n+\n test_done\n-- \n1.7.9.rc2.155.g2e96\n"},{"id":"184582","messageId":"7vipjafu27.fsf@alter.siamese.dyndns.org","threadId":"29612","inReplyTo":"1329133736-20817-1-git-send-email-michal.kiedrowicz@gmail.com","subject":"Re: [BUG] git-merge-octopus creates an empty merge commit with one parent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-13T18:48:48Z","receivedAt":"2012-02-13T18:48:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:\n\n> This happens when git merge is run to merge multiple commits that are\n> descendants of current HEAD (or are HEAD).\n\nI am reasonably sure you meant ancestors here.\n\n> to origin/master but accidentaly we called (while being on master):\n>\n> \t$ git merge master origin/master\n\nI am very tempted to throw this into \"don't do it then\" category.\n"},{"id":"184589","messageId":"20120213202039.5346fa89@gmail.com","threadId":"29612","inReplyTo":"7vipjafu27.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git-merge-octopus creates an empty merge commit with one parent","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2012-02-13T19:20:39Z","receivedAt":"2012-02-13T19:20:39Z","isPatch":false,"sender":{"key":"michal.kiedrowicz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14072847?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n\n> Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:\n> \n> > This happens when git merge is run to merge multiple commits that are\n> > descendants of current HEAD (or are HEAD).\n> \n> I am reasonably sure you meant ancestors here.\n\nI meant: ... to merge commits whose parent, grand-parent or\ngrand-grand-...-parent is HEAD. Commits to which HEAD may be\nfast-forwarded.\n\n> \n> > to origin/master but accidentaly we called (while being on master):\n> >\n> > \t$ git merge master origin/master\n> \n> I am very tempted to throw this into \"don't do it then\" category.\n\nI'm all for it. This is not a thing I would want to be doing. At\nno time I would call this \"a serious bug that needs fixing right\nnow\". Except that I still think this behavior is not correct. git-merge\nshould not create commits that even aren't merges (they have single\nparrent) and have exactly the same tree as its parent, and give it a\nmessage \"merge\". Isn't this against the normal behavior of Git:\nforwarding if possible and refusing to create commits that don't change\nany file?\n"},{"id":"184590","messageId":"7vpqdieclu.fsf@alter.siamese.dyndns.org","threadId":"29612","inReplyTo":"20120213202039.5346fa89@gmail.com","subject":"Re: [BUG] git-merge-octopus creates an empty merge commit with one parent","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-13T19:51:09Z","receivedAt":"2012-02-13T19:51:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michał Kiedrowicz <michal.kiedrowicz@gmail.com> writes:\n\n> ... Except that I still think this behavior is not correct.\n\nWell, what was missing from my \"don't do it then\" quote was \"Doctor it\nHURTS when I do this.\"; there is no question that it is not correct if it\nhurts ;-).\n\nPatches welcome; I suspect it shouldn't be too intrusive or difficult.\n"},{"id":"184604","messageId":"loom.20120213T215153-833@post.gmane.org","threadId":"29612","inReplyTo":"7vpqdieclu.fsf@alter.siamese.dyndns.org","subject":"Re: [BUG] git-merge-octopus creates an empty merge commit with one parent","fromName":"Michał Kiedrowicz","fromEmail":"michal.kiedrowicz@gmail.com","sentAt":"2012-02-13T20:53:12Z","receivedAt":"2012-02-13T20:53:12Z","isPatch":false,"sender":{"key":"michal.kiedrowicz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14072847?v=4"},"body":"Junio C Hamano <gitster <at> pobox.com> writes:\n\n> Well, what was missing from my \"don't do it then\" quote was \"Doctor it\n> HURTS when I do this.\"; there is no question that it is not correct if it\n> hurts .\n\nAll right :)\n"}]}