{"thread":{"id":"22996","subject":"[PATCH] Bug: failed octopus merge does not create MERGE_HEAD","startedAt":"2010-03-12T14:07:15Z","lastAt":"2010-03-14T19:24:24Z","messageCount":3,"participants":["Michal Sojka","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"136658","messageId":"1268402835-12992-1-git-send-email-sojkam1@fel.cvut.cz","threadId":"22996","inReplyTo":null,"subject":"[PATCH] Bug: failed octopus merge does not create MERGE_HEAD","fromName":"Michal Sojka","fromEmail":"sojkam1@fel.cvut.cz","sentAt":"2010-03-12T14:07:15Z","receivedAt":"2010-03-12T14:07:15Z","isPatch":true,"sender":{"key":"sojkam1@fel.cvut.cz","avatar":"https://avatars.githubusercontent.com/u/140542?v=4"},"body":"Hi,\n\nthe following test case exhibits behavior which I think is a bug. If\nmerge-one-file cannot handle the merge we end up with unmerged index\nentries and no MERGE_HEAD created. I suppose that MERGE_HEAD should be\ncreated whenever a merge fails.\n\nIf someone gives me a hint how to correct this, I can try to do it.\n\nSigned-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\n\n---\n t/t7611-merge-octopus-fail.sh |   29 +++++++++++++++++++++++++++++\n 1 files changed, 29 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7611-merge-octopus-fail.sh b/t/t7611-merge-octopus-fail.sh\nnew file mode 100755\nindex 0000000..b7f983b\n--- /dev/null\n+++ b/t/t7611-merge-octopus-fail.sh\n@@ -0,0 +1,29 @@\n+#!/bin/sh\n+\n+test_description='git merge\n+\n+Testing octopus merge with one file changed and deleted on different branches.\n+'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'setup' '\n+\ttest_commit initial file &&\n+\ttest_commit changed file &&\n+\tgit reset --hard initial -- &&\n+\tgit rm file &&\n+\tgit commit -m deleted &&\n+\tgit tag deleted &&\n+\tgit reset --hard initial -- &&\n+\ttest_commit file2\n+'\n+test_expect_success 'failed octopus merge' '\n+\tgit reset --hard changed &&\n+\ttest_must_fail git merge deleted file2\n+'\n+\n+test_expect_failure 'check that MERGE_HEAD exists' '\n+\ttest -f .git/MERGE_HEAD\n+'\n+\n+test_done\n-- \ntg: (90a2bf9..) t/test-failed-octopus-merge (depends on: master)\n"},{"id":"136727","messageId":"7vr5no7xlo.fsf@alter.siamese.dyndns.org","threadId":"22996","inReplyTo":"1268402835-12992-1-git-send-email-sojkam1@fel.cvut.cz","subject":"Re: [PATCH] Bug: failed octopus merge does not create MERGE_HEAD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-13T20:52:51Z","receivedAt":"2010-03-13T20:52:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hmm.\n\nWhen it detects conflicts, and refuses to make a merge, the octopus\nbackend says \"should not be doing an octopus\".  As far as I can tell,\nMERGE_HEAD is useful only when resolving conflicts, and the octopus\nstrongly discourages recording anything but the simplest conflict-free\nmerges.  That makes me think that not writing the file out would be the\nmore correct thing to do.\n\nOne possibility I can think of is that we try to prevent user mistakes by\nchecking the existence of MERGE_HEAD (i.e. \"can't do this, you are still\nduring a merge\"), and not writing MERGE_HEAD in this case, but still\npotentially leaving the index unmerged, may allow some operations that we\nshould prevent from being invoked to proceed.  Is that the issue you are\ntrying to address?  Or is there something else?  Why do you want to have\nMERGE_HEAD?\n"},{"id":"136770","messageId":"87r5nmzoyf.fsf@steelpick.localdomain","threadId":"22996","inReplyTo":"7vr5no7xlo.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Bug: failed octopus merge does not create MERGE_HEAD","fromName":"Michal Sojka","fromEmail":"sojkam1@fel.cvut.cz","sentAt":"2010-03-14T19:24:24Z","receivedAt":"2010-03-14T19:24:24Z","isPatch":true,"sender":{"key":"sojkam1@fel.cvut.cz","avatar":"https://avatars.githubusercontent.com/u/140542?v=4"},"body":"On Sat, 13 Mar 2010, Junio C Hamano wrote:\n> Hmm.\n> \n> When it detects conflicts, and refuses to make a merge, the octopus\n> backend says \"should not be doing an octopus\".  As far as I can tell,\n> MERGE_HEAD is useful only when resolving conflicts, and the octopus\n\nThere is also another use - see below.\n\n> strongly discourages recording anything but the simplest conflict-free\n> merges.\n\nHow can I know in advance that the merge will be conflict free? I have a\nscript which merges a bunch of (simple) topic branches which usually\nmerge without conflict, but from time to time some branch evolves and\nconflicts.\n\n> That makes me think that not writing the file out would be the more\n> correct thing to do.\n\n> \n> One possibility I can think of is that we try to prevent user mistakes by\n> checking the existence of MERGE_HEAD (i.e. \"can't do this, you are still\n> during a merge\"), and not writing MERGE_HEAD in this case, but still\n> potentially leaving the index unmerged, may allow some operations that we\n> should prevent from being invoked to proceed.  Is that the issue you are\n> trying to address?  Or is there something else?  Why do you want to have\n> MERGE_HEAD?\n\nI'm using zsh and vcs_info which shows me git repo status in my prompt\n(see e.g. http://www.jukie.net/~bart/blog/pimping-out-zsh-prompt).\nvcs_info tests for existence of MERGE_HEAD to signalize that you are in\nthe middle of merge. If MERGE_HEAD is not created I do not see a big red\nwaning in my prompt and I expect the merge to be successful.\n\nIn my experiments I found that octopus creates MERGE_HEAD in several\nsituations but not in the one when a branch modifies the file and\nanother deletes it. Therefore I think it is a bug.\n\n-Michal\n"}]}