{"thread":{"id":"21762","subject":"Octopus merge","startedAt":"2009-11-26T15:56:02Z","lastAt":"2009-12-09T15:10:22Z","messageCount":4,"participants":["claudia.ignat@loria.fr","Thomas Rast","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"128474","messageId":"4B0EA512.1050001@loria.fr","threadId":"21762","inReplyTo":null,"subject":"Octopus merge","fromName":"","fromEmail":"claudia.ignat@loria.fr","sentAt":"2009-11-26T15:56:02Z","receivedAt":"2009-11-26T15:56:02Z","isPatch":false,"sender":{"key":"claudia.ignat@loria.fr","avatar":null},"body":"Hello,\n\nI have problems on understanding the results of octopus merge in the \nfollowing scenario.\n\nWorkspaces ws2, ws3, ws4 and ws5 are clones of the workspace ws1. \nSuppose the current workspace is ws3 and some changes are done in \nparallel in all these 4 workspaces. Further suppose that changes of ws2 \nand ws3 are conflicting, while the changes in ws4 and ws5 are neither \nconflicting between them nor with ws2 and ws3.\n\nWhile I am in the current workspace ws3 I perform the merge\n\ngit merge ws4 ws2 ws5\n\nObviously I obtain conflicts between changes in ws3 and ws2 which I fix \nmanually and afterwards I commit the new version of ws3. It seems \nstrange that the commit object has only one parent, while including the \nchanges of ws4.\n\nIf instead I perform\n\ngit merge ws4 ws5 ws2\n\nand fix manually the conflicts and performing the commit, the commit \nobject has 4 parents (ws3,ws4,ws5 and ws2).\n\nI provide below the script illustrating the first scenario:\n\n# !/bin/bash\nTEST_NAME=\"TP1\" # name of the working directory\nrm -rf ${TEST_NAME} # cleaning working directory\nmkdir -p ${TEST_NAME}\ncd ${TEST_NAME}\n\n# initialising initial git workspace\nmkdir ws1\ncd ws1\ngit init\n\n# adding a file to ws1\n# commit changes\necho -e -n \"1\\n2\\n3\\n4\\n5\\n\" > file.txt\ngit add file.txt\ngit commit -m \"ws1 | add 12345\"\ncd ..\n\n# cloning three times ws1 (as ws2, ws3 and ws4)\ngit clone ws1 ws2\ngit clone ws1 ws3\ngit clone ws1 ws4\ngit clone ws1 ws5\n\n# updating file.txt in ws2 (insert X at line 3, then write and quit 'ed')\n# commit changes\ncd ws2\necho -e \"3i\\nX\\n.\\nw\\nq\\n\" | ed file.txt\ngit add file.txt\ngit commit -m \"ws2 | insert 12X345\"\ncd ..\n\n\n# updating file.txt in ws3 (insert Y at line 3, then write and quit 'ed')\n# commit changes\ncd ws3\necho -e \"3i\\nY\\n.\\nw\\nq\\n\" | ed file.txt\ngit add file.txt\ngit commit -m \"ws3 | insert 12Y345\"\ncd ..\n\ncd ws4\necho -e -n \"U1\\n2\\n3\\n4\\n5\\n\" >  u.txt\ngit add u.txt\ngit commit -m \"ws4 | add u.txt\"\ncd ..\n\ncd ws5\necho -e -n \"W1\\n2\\n3\\n4\\n5\\n\" > w.txt\ngit add w.txt\ngit commit -m \"ws5 | add w.txt\"\ncd ..\n\n# ws3 pull from ws2 ws4 ws5\ncd ws3\ngit remote add bws2 ../ws2\ngit remote add bws4 ../ws4\ngit remote add bws5 ../ws5\ngit fetch bws2\ngit fetch bws4\ngit fetch bws5\ngit merge bws4/master bws2/master bws5/master\ncd ..\n\n# resolve conflict in ws3\ncd ws3\necho -e '7d\\n5d\\n3d\\n.\\nw\\nq\\n' | ed file.txt\ngit add file.txt\ngit commit -m \"ws3| in file.txt solve conflict (kept XY) \"\ncd ..\n\nCould somebody please explain me these results? I suspect a bug in \noctopus merge. I am using version 1.6.3.3 of git.\nThank you in advance.\n\nBest regards,\nClaudia Ignat\n"},{"id":"128478","messageId":"200911261744.56913.trast@student.ethz.ch","threadId":"21762","inReplyTo":"4B0EA512.1050001@loria.fr","subject":"Re: Octopus merge","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-11-26T16:44:52Z","receivedAt":"2009-11-26T16:44:52Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Claudia.Ignat@loria.fr wrote:\n> \n> While I am in the current workspace ws3 I perform the merge\n> \n> git merge ws4 ws2 ws5\n> \n> Obviously I obtain conflicts between changes in ws3 and ws2 which I fix \n> manually and afterwards I commit the new version of ws3.\n\nIn doing that last step, you ignored the crucial bit of advice printed\nby the octopus merge:\n\n  Automated merge did not work.\n  Should not be doing an Octopus.\t\t# <<--\n  Merge with strategy octopus failed.\n\nYou should simply merge and resolve them separately, not least of all\nbecause in doing so, 'git show $merge' will display your merge\nresolutions.  An octopus would tangle all resolutions into a single\ncommit.\n\nAFAIK the only thing that can be considered a bug here is that the\noctopus strategy leaves your worktree in need of 'reset --hard'.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"128479","messageId":"4B0EB257.8080002@drmicha.warpmail.net","threadId":"21762","inReplyTo":"4B0EA512.1050001@loria.fr","subject":"Re: Octopus merge","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-11-26T16:52:39Z","receivedAt":"2009-11-26T16:52:39Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Claudia.Ignat@loria.fr venit, vidit, dixit 26.11.2009 16:56:\n> # !/bin/bash\n> TEST_NAME=\"TP1\" # name of the working directory\n> rm -rf ${TEST_NAME} # cleaning working directory\n> mkdir -p ${TEST_NAME}\n> cd ${TEST_NAME}\n> \n> # initialising initial git workspace\n> mkdir ws1\n> cd ws1\n> git init\n> \n> # adding a file to ws1\n> # commit changes\n> echo -e -n \"1\\n2\\n3\\n4\\n5\\n\" > file.txt\n> git add file.txt\n> git commit -m \"ws1 | add 12345\"\n> cd ..\n> \n> # cloning three times ws1 (as ws2, ws3 and ws4)\n> git clone ws1 ws2\n> git clone ws1 ws3\n> git clone ws1 ws4\n> git clone ws1 ws5\n> \n> # updating file.txt in ws2 (insert X at line 3, then write and quit 'ed')\n> # commit changes\n> cd ws2\n> echo -e \"3i\\nX\\n.\\nw\\nq\\n\" | ed file.txt\n> git add file.txt\n> git commit -m \"ws2 | insert 12X345\"\n> cd ..\n> \n> \n> # updating file.txt in ws3 (insert Y at line 3, then write and quit 'ed')\n> # commit changes\n> cd ws3\n> echo -e \"3i\\nY\\n.\\nw\\nq\\n\" | ed file.txt\n> git add file.txt\n> git commit -m \"ws3 | insert 12Y345\"\n> cd ..\n> \n> cd ws4\n> echo -e -n \"U1\\n2\\n3\\n4\\n5\\n\" >  u.txt\n> git add u.txt\n> git commit -m \"ws4 | add u.txt\"\n> cd ..\n> \n> cd ws5\n> echo -e -n \"W1\\n2\\n3\\n4\\n5\\n\" > w.txt\n> git add w.txt\n> git commit -m \"ws5 | add w.txt\"\n> cd ..\n> \n> # ws3 pull from ws2 ws4 ws5\n> cd ws3\n> git remote add bws2 ../ws2\n> git remote add bws4 ../ws4\n> git remote add bws5 ../ws5\n> git fetch bws2\n> git fetch bws4\n> git fetch bws5\n> git merge bws4/master bws2/master bws5/master\n> cd ..\n> \n> # resolve conflict in ws3\n> cd ws3\n\nFirst of all, thanks for the clear description and test case!\n\nThe octopus strategy cannot do merges which need manual resolution. Or\nso the doc says. After trying the merge with 4 2 5, Git tells you:\n\nTrying simple merge with 7ff9b5bd514cb600bac935ebd40eae366bba7d19\nTrying simple merge with 6872cd350154743d59cb4d313cbdb122ac43e537\nSimple merge did not work, trying automatic merge.\nAuto-merging file.txt\nERROR: content conflict in file.txt\nfatal: merge program failed\nAutomated merge did not work.\nShould not be doing an Octopus.\nMerge with strategy octopus failed.\n\nThat is, it aborts the merge completely. If you \"resolve\" it and commit\nit's simply a commit that you make.\n\nIf, instead, you merge 4 5 2, Git tells you:\n\nTrying simple merge with e4f78f6905bed39bcd96790a4f63e138a455a445\nTrying simple merge with 14c1f2a70767334df5d6d3120631752564094699\nTrying simple merge with 8540a039d3fc964d097d4f037357668441d1d4f5\nSimple merge did not work, trying automatic merge.\nAuto-merging file.txt\nERROR: content conflict in file.txt\nfatal: merge program failed\nAutomatic merge failed; fix conflicts and then commit the result.\n\nAdmittedly this looks fatal also, but the last line tells you that the\nactual merge process is not aborted yet. If you resolve the conflict and\ncommit without -m you even see the prepared commit message.\n\nSo, octopus can deal with manual conflict resolution if the conflicts\nappear in the last step only. That is the difference between the two cases.\n\nNow, in the first case the aborted merge leaves some traces in the index\nas well as in the worktree. I'm not sure that is how it's supposed to be.\n\nCheers,\nMichael\n"},{"id":"129637","messageId":"4B1FBDDE.60803@loria.fr","threadId":"21762","inReplyTo":"4B0EB257.8080002@drmicha.warpmail.net","subject":"Re: Octopus merge","fromName":"","fromEmail":"claudia.ignat@loria.fr","sentAt":"2009-12-09T15:10:22Z","receivedAt":"2009-12-09T15:10:22Z","isPatch":false,"sender":{"key":"claudia.ignat@loria.fr","avatar":null},"body":"Michael and Thomas, thank you for your explanations. The fact that in \nsome cases octopus merge fails, but changes of the first merges subparts \nof octopus merge are included in the worktree rests a dilemma.\n\nFurther, I have noticed that for the same conflicting changes the \nconflict messages (referring to conflict types) received in the case of \nan octopus merge are not the same as the conflict messages received for \nthe corresponding sequential merges.\n\nI slightly changed the scenario I described in my previous message.\n\nWorkspaces ws2, ws3 and ws4 are clones of the workspace ws1. Suppose the \ncurrent workspace is ws3 and some changes are done in parallel in all \nthese 3 workspaces. Changes of ws2 and ws3 are conflicting: both modify \nthe same line of file file1.txt to different values and they rename the \nsame file file2.txt to fileWS2.txt and fileWS3.txt respectively. Changes \nin ws4 are not conflicting with changes in ws2 and ws3.\n\nWhile I am in the current workspace ws3 I perform the merge\n\ngit merge ws2\n\nand content conflict in file1.txt as well as rename/rename conflict are \nsignaled.\n\nIf instead I perform the merge\n\ngit merge ws4 ws2\n\nonly the content conflict  in file1.txt is raised, while the conflict \nrename/rename of file2.txt is not mentioned.\n\nThe script for the second mentioned scenario is given below.\n\nDo you think this should be the normal behavior of octopus merge?\n\nThanks.\nCheers,\nClaudia\n\n# !/bin/bash\n\nTEST_NAME=\"TP1\" # name of the working directory\nrm -rf ${TEST_NAME} # cleaning working directory\nmkdir -p ${TEST_NAME}\ncd ${TEST_NAME}\n\n# initialising initial git workspace\nmkdir ws1\ncd ws1\ngit init\n\n# adding 2 files to ws1\n# commit changes\necho -e -n \"1\\n2\\n3\\n4\\n5\\n\" > file1.txt\necho -e -n \"a\\nb\\nc\\nd\\ne\\n\" > file2.txt\ngit add file1.txt file2.txt\ngit commit -m \"ws1 | add 12345 in file1.txt; add abcde in file2.txt\"\ncd ..\n\n# cloning three times ws1 (as ws2, ws3 and ws4)\ngit clone ws1 ws2\ngit clone ws1 ws3\ngit clone ws1 ws4\n\n# updating file1.txt in ws2 (insert X at line 3, then write and quit 'ed')\n# rename file2.txt to fileWS2.txt\n# commit changes\ncd ws2\necho -e \"3i\\nX\\n.\\nw\\nq\\n\" | ed file1.txt\ngit add file1.txt\ngit mv file2.txt fileWS2.txt\ngit commit -m \"ws2 | insert 12X345 in file1.txt; rename file2.txt to \nfileWS2.txt\"\ncd ..\n\n\n# updating file1.txt in ws3 (insert Y at line 3, then write and quit 'ed')\n# rename file2.txt to fileWS3.txt\n# commit changes\ncd ws3\necho -e \"3i\\nY\\n.\\nw\\nq\\n\" | ed file1.txt\ngit add file1.txt\ngit mv file2.txt fileWS3.txt\ngit commit -m \"ws3 | insert 12Y345 in file1.txt; rename file2.txt to \nfileWS3.txt\"\ncd ..\n\n# add file u.txt in ws4\ncd ws4\necho -e -n \"U1\\n2\\n3\\n4\\n5\\n\" >  u.txt\ngit add u.txt\ngit commit -m \"ws4 | add u.txt\"\ncd ..\n\n# ws3 pull from ws2 ws4\ncd ws3\ngit remote add bws2 ../ws2\ngit remote add bws4 ../ws4\ngit fetch bws2\ngit fetch bws4\ngit merge bws4/master bws2/master\ncd ..\n\n\n\nMichael J Gruber wrote:\n> Claudia.Ignat@loria.fr venit, vidit, dixit 26.11.2009 16:56:\n>> # !/bin/bash\n>> TEST_NAME=\"TP1\" # name of the working directory\n>> rm -rf ${TEST_NAME} # cleaning working directory\n>> mkdir -p ${TEST_NAME}\n>> cd ${TEST_NAME}\n>>\n>> # initialising initial git workspace\n>> mkdir ws1\n>> cd ws1\n>> git init\n>>\n>> # adding a file to ws1\n>> # commit changes\n>> echo -e -n \"1\\n2\\n3\\n4\\n5\\n\" > file.txt\n>> git add file.txt\n>> git commit -m \"ws1 | add 12345\"\n>> cd ..\n>>\n>> # cloning three times ws1 (as ws2, ws3 and ws4)\n>> git clone ws1 ws2\n>> git clone ws1 ws3\n>> git clone ws1 ws4\n>> git clone ws1 ws5\n>>\n>> # updating file.txt in ws2 (insert X at line 3, then write and quit 'ed')\n>> # commit changes\n>> cd ws2\n>> echo -e \"3i\\nX\\n.\\nw\\nq\\n\" | ed file.txt\n>> git add file.txt\n>> git commit -m \"ws2 | insert 12X345\"\n>> cd ..\n>>\n>>\n>> # updating file.txt in ws3 (insert Y at line 3, then write and quit 'ed')\n>> # commit changes\n>> cd ws3\n>> echo -e \"3i\\nY\\n.\\nw\\nq\\n\" | ed file.txt\n>> git add file.txt\n>> git commit -m \"ws3 | insert 12Y345\"\n>> cd ..\n>>\n>> cd ws4\n>> echo -e -n \"U1\\n2\\n3\\n4\\n5\\n\" >  u.txt\n>> git add u.txt\n>> git commit -m \"ws4 | add u.txt\"\n>> cd ..\n>>\n>> cd ws5\n>> echo -e -n \"W1\\n2\\n3\\n4\\n5\\n\" > w.txt\n>> git add w.txt\n>> git commit -m \"ws5 | add w.txt\"\n>> cd ..\n>>\n>> # ws3 pull from ws2 ws4 ws5\n>> cd ws3\n>> git remote add bws2 ../ws2\n>> git remote add bws4 ../ws4\n>> git remote add bws5 ../ws5\n>> git fetch bws2\n>> git fetch bws4\n>> git fetch bws5\n>> git merge bws4/master bws2/master bws5/master\n>> cd ..\n>>\n>> # resolve conflict in ws3\n>> cd ws3\n> \n> First of all, thanks for the clear description and test case!\n> \n> The octopus strategy cannot do merges which need manual resolution. Or\n> so the doc says. After trying the merge with 4 2 5, Git tells you:\n> \n> Trying simple merge with 7ff9b5bd514cb600bac935ebd40eae366bba7d19\n> Trying simple merge with 6872cd350154743d59cb4d313cbdb122ac43e537\n> Simple merge did not work, trying automatic merge.\n> Auto-merging file.txt\n> ERROR: content conflict in file.txt\n> fatal: merge program failed\n> Automated merge did not work.\n> Should not be doing an Octopus.\n> Merge with strategy octopus failed.\n> \n> That is, it aborts the merge completely. If you \"resolve\" it and commit\n> it's simply a commit that you make.\n> \n> If, instead, you merge 4 5 2, Git tells you:\n> \n> Trying simple merge with e4f78f6905bed39bcd96790a4f63e138a455a445\n> Trying simple merge with 14c1f2a70767334df5d6d3120631752564094699\n> Trying simple merge with 8540a039d3fc964d097d4f037357668441d1d4f5\n> Simple merge did not work, trying automatic merge.\n> Auto-merging file.txt\n> ERROR: content conflict in file.txt\n> fatal: merge program failed\n> Automatic merge failed; fix conflicts and then commit the result.\n> \n> Admittedly this looks fatal also, but the last line tells you that the\n> actual merge process is not aborted yet. If you resolve the conflict and\n> commit without -m you even see the prepared commit message.\n> \n> So, octopus can deal with manual conflict resolution if the conflicts\n> appear in the last step only. That is the difference between the two cases.\n> \n> Now, in the first case the aborted merge leaves some traces in the index\n> as well as in the worktree. I'm not sure that is how it's supposed to be.\n> \n> Cheers,\n> Michael\n"}]}