{"thread":{"id":"13207","subject":"showing conflicting merges","startedAt":"2008-04-22T09:12:33Z","lastAt":"2008-04-24T13:08:44Z","messageCount":5,"participants":["Uwe Kleine-König","Santi Béjar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"74931","messageId":"20080422091233.GA12091@digi.com","threadId":"13207","inReplyTo":null,"subject":"showing conflicting merges","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-04-22T09:12:33Z","receivedAt":"2008-04-22T09:12:33Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nThere is a thread on the linux-arm-kernel ML that discusses handling of\nmerge conflicts with git.[1]\n\nI played around a bit with that and wondered about a few things:\n\n\tukleinek@zentaur:~/gsrc/linux-2.6$ git checkout -b test adf6d34e460387ee3e8f1e1875d\n\tSwitched to a new branch \"test\"\n\n\tukleinek@zentaur:~/gsrc/linux-2.6$ git merge v2.6.25\n\tAuto-merged MAINTAINERS\n\tCONFLICT (delete/modify): drivers/leds/leds-tosa.c deleted in HEAD and modified in v2.6.25. Version v2.6.25 of drivers/leds/leds-tosa.c left in tree.\n\tAuto-merged drivers/serial/imx.c\n\tAutomatic merge failed; fix conflicts and then commit the result.\n\nNow \"git diff --merge\" shows:\n\n\tdiff --cc drivers/leds/leds-tosa.c\n\tindex 7ebecc4,0000000..9e0a188\n\t...\n\nShouldn't that better be reversed, i.e. 9e0a188..7ebecc4,0000000?\n\nThe resolution was to delete drivers/leds/leds-tosa.c:\n\n\tukleinek@zentaur:~/gsrc/linux-2.6$ git rm drivers/leds/leds-tosa.c\n\trm 'drivers/leds/leds-tosa.c'\n\trm 'drivers/leds/leds-tosa.c'\n\n\tukleinek@zentaur:~/gsrc/linux-2.6$ git commit\n\tCreated commit 99a64ab: Merge commit 'v2.6.25' into test\n\nNow \"git show\" doesn't show the conflict resolution as it does for other\nconflicting merges.\nAdding -p and/or --cc didn't help either.  Looking at the source I think\nthe problem is that diff_tree_combined only shows diffs for paths that\nare touched by every parent.  I'm not sure how I want to have the diff\nshown, but showing nothing seems wrong.  Ideas?\n\nAnother thing is that rerere don't record my resolution.\n\nBest regards\nUwe\n\n[1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/40654/focus=40656\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":"74934","messageId":"8aa486160804220249y55677f63o892643775960880f@mail.gmail.com","threadId":"13207","inReplyTo":"20080422091233.GA12091@digi.com","subject":"Re: showing conflicting merges","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-22T09:49:23Z","receivedAt":"2008-04-22T09:49:23Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Tue, Apr 22, 2008 at 11:12 AM, Uwe Kleine-König\n<Uwe.Kleine-Koenig@digi.com> wrote:\n> Hello,\n>\n>  There is a thread on the linux-arm-kernel ML that discusses handling of\n>  merge conflicts with git.[1]\n>\n>  I played around a bit with that and wondered about a few things:\n>\n>         ukleinek@zentaur:~/gsrc/linux-2.6$ git checkout -b test adf6d34e460387ee3e8f1e1875d\n>         Switched to a new branch \"test\"\n>\n>         ukleinek@zentaur:~/gsrc/linux-2.6$ git merge v2.6.25\n>         Auto-merged MAINTAINERS\n>         CONFLICT (delete/modify): drivers/leds/leds-tosa.c deleted in HEAD and modified in v2.6.25. Version v2.6.25 of drivers/leds/leds-tosa.c left in tree.\n>         Auto-merged drivers/serial/imx.c\n>         Automatic merge failed; fix conflicts and then commit the result.\n>\n>  Now \"git diff --merge\" shows:\n>\n>         diff --cc drivers/leds/leds-tosa.c\n>         index 7ebecc4,0000000..9e0a188\n>         ...\n>\n>  Shouldn't that better be reversed, i.e. 9e0a188..7ebecc4,0000000?\n\nIt compares the versions in conflict with the version in the working copy.\n\n>\n>  The resolution was to delete drivers/leds/leds-tosa.c:\n>\n>         ukleinek@zentaur:~/gsrc/linux-2.6$ git rm drivers/leds/leds-tosa.c\n>         rm 'drivers/leds/leds-tosa.c'\n>         rm 'drivers/leds/leds-tosa.c'\n>\n>         ukleinek@zentaur:~/gsrc/linux-2.6$ git commit\n>         Created commit 99a64ab: Merge commit 'v2.6.25' into test\n>\n>  Now \"git show\" doesn't show the conflict resolution as it does for other\n>  conflicting merges.\n>  Adding -p and/or --cc didn't help either.  Looking at the source I think\n>  the problem is that diff_tree_combined only shows diffs for paths that\n>  are touched by every parent.  I'm not sure how I want to have the diff\n>  shown, but showing nothing seems wrong.  Ideas?\n\nThe combined diff does not show conflicts, it only shows the merged\nresults that are different to all the parents. In this case the merge\nresolution is to delete one file as in HEAD, so it won't be shown.\n\nIf you want to see the conflict resolution you have to recreate the\nmerge and compare with the original merge.\n\nSanti\n"},{"id":"75035","messageId":"20080423061715.GB25446@digi.com","threadId":"13207","inReplyTo":"8aa486160804220249y55677f63o892643775960880f@mail.gmail.com","subject":"Re: showing conflicting merges","fromName":"Uwe Kleine-König","fromEmail":"uwe.kleine-koenig@digi.com","sentAt":"2008-04-23T06:17:15Z","receivedAt":"2008-04-23T06:17:15Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Santi,\n\nSanti Béjar wrote:\n> On Tue, Apr 22, 2008 at 11:12 AM, Uwe Kleine-König\n> <Uwe.Kleine-Koenig@digi.com> wrote:\n> > Hello,\n> >\n> >  There is a thread on the linux-arm-kernel ML that discusses handling of\n> >  merge conflicts with git.[1]\n> >\n> >  I played around a bit with that and wondered about a few things:\n> >\n> >         ukleinek@zentaur:~/gsrc/linux-2.6$ git checkout -b test adf6d34e460387ee3e8f1e1875d\n> >         Switched to a new branch \"test\"\n> >\n> >         ukleinek@zentaur:~/gsrc/linux-2.6$ git merge v2.6.25\n> >         Auto-merged MAINTAINERS\n> >         CONFLICT (delete/modify): drivers/leds/leds-tosa.c deleted in HEAD and modified in v2.6.25. Version v2.6.25 of drivers/leds/leds-tosa.c left in tree.\n> >         Auto-merged drivers/serial/imx.c\n> >         Automatic merge failed; fix conflicts and then commit the result.\n> >\n> >  Now \"git diff --merge\" shows:\n> >\n> >         diff --cc drivers/leds/leds-tosa.c\n> >         index 7ebecc4,0000000..9e0a188\n> >         ...\n> >\n> >  Shouldn't that better be reversed, i.e. 9e0a188..7ebecc4,0000000?\n> \n> It compares the versions in conflict with the version in the working copy.\n\nI have not checked in the source code, but the output of \n\n\tstrace -f -e open git diff --merge 2>&1 >/dev/null | grep leds-tosa\n\nseems to contradict that (i.e. there is no output).\n\n\t7ebecc4 = v2.6.25:drivers/leds/leds-tosa.c\n\t9e0a188 = $(git merge-base test v2.6.25):drivers/leds/leds-tosa.c\n\n(Ah, I just see, that's another hint that diff --merge doesn't look in\nthe working copy.  The wc has 7ebecc4 which is in the LHS together with\n000000 (i.e. the deleted file from HEAD).\n\nMaybe the combined diff format cannot have more than one rev on the RHS?\n\n> >  The resolution was to delete drivers/leds/leds-tosa.c:\n> >\n> >         ukleinek@zentaur:~/gsrc/linux-2.6$ git rm drivers/leds/leds-tosa.c\n> >         rm 'drivers/leds/leds-tosa.c'\n> >         rm 'drivers/leds/leds-tosa.c'\n> >\n> >         ukleinek@zentaur:~/gsrc/linux-2.6$ git commit\n> >         Created commit 99a64ab: Merge commit 'v2.6.25' into test\n> >\n> >  Now \"git show\" doesn't show the conflict resolution as it does for other\n> >  conflicting merges.\n> >  Adding -p and/or --cc didn't help either.  Looking at the source I think\n> >  the problem is that diff_tree_combined only shows diffs for paths that\n> >  are touched by every parent.  I'm not sure how I want to have the diff\n> >  shown, but showing nothing seems wrong.  Ideas?\n> \n> The combined diff does not show conflicts, it only shows the merged\n> results that are different to all the parents. In this case the merge\n> resolution is to delete one file as in HEAD, so it won't be shown.\n> \n> If you want to see the conflict resolution you have to recreate the\n> merge and compare with the original merge.\nAn option to show would be great ...\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":"75146","messageId":"8aa486160804240551y1d1e412cvb6801e652026f832@mail.gmail.com","threadId":"13207","inReplyTo":"20080423061715.GB25446@digi.com","subject":"Re: showing conflicting merges","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-24T12:51:31Z","receivedAt":"2008-04-24T12:51:31Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Wed, Apr 23, 2008 at 8:17 AM, Uwe Kleine-König\n<Uwe.Kleine-Koenig@digi.com> wrote:\n> Hello Santi,\n>\n>\n>  Santi Béjar wrote:\n>  > On Tue, Apr 22, 2008 at 11:12 AM, Uwe Kleine-König\n>  > <Uwe.Kleine-Koenig@digi.com> wrote:\n>  > > Hello,\n>  > >\n>  > >  There is a thread on the linux-arm-kernel ML that discusses handling of\n>  > >  merge conflicts with git.[1]\n>  > >\n>  > >  I played around a bit with that and wondered about a few things:\n>  > >\n>  > >         ukleinek@zentaur:~/gsrc/linux-2.6$ git checkout -b test adf6d34e460387ee3e8f1e1875d\n>  > >         Switched to a new branch \"test\"\n>  > >\n>  > >         ukleinek@zentaur:~/gsrc/linux-2.6$ git merge v2.6.25\n>  > >         Auto-merged MAINTAINERS\n>  > >         CONFLICT (delete/modify): drivers/leds/leds-tosa.c deleted in HEAD and modified in v2.6.25. Version v2.6.25 of drivers/leds/leds-tosa.c left in tree.\n>  > >         Auto-merged drivers/serial/imx.c\n>  > >         Automatic merge failed; fix conflicts and then commit the result.\n>  > >\n>  > >  Now \"git diff --merge\" shows:\n>  > >\n>  > >         diff --cc drivers/leds/leds-tosa.c\n>  > >         index 7ebecc4,0000000..9e0a188\n>  > >         ...\n>  > >\n>  > >  Shouldn't that better be reversed, i.e. 9e0a188..7ebecc4,0000000?\n>  >\n>  > It compares the versions in conflict with the version in the working copy.\n>\n>  I have not checked in the source code, but the output of\n>\n>         strace -f -e open git diff --merge 2>&1 >/dev/null | grep leds-tosa\n>\n>  seems to contradict that (i.e. there is no output).\n\nThe version in the working copy should be 7ebecc4, so there is no need\nto open it as it is in the index (but maybe I'm wrong).\n\n>\n>         7ebecc4 = v2.6.25:drivers/leds/leds-tosa.c\n>         9e0a188 = $(git merge-base test v2.6.25):drivers/leds/leds-tosa.c\n>\n>  (Ah, I just see, that's another hint that diff --merge doesn't look in\n>  the working copy.  The wc has 7ebecc4 which is in the LHS together with\n>  000000 (i.e. the deleted file from HEAD).\n>\n>  Maybe the combined diff format cannot have more than one rev on the RHS?\n>\n>\n\nFWIU --merge is an option for git-rev-list (and alike, git log,\ngitk...). I don't know its meaning in this case. It shoud be juts:\n\n$git diff\n\nthat currently says in this case:\n\n$ git diff\n* Unmerged path file1\n\nIn this case:\n\n\techo a >file1 &&\n\tgit add file1 &&\n\tgit commit -m initial &&\n\tgit checkout -b a1 master &&\n\tgit rm file1 &&\n\tgit commit -m a &&\n\tgit checkout -b b1 master &&\n\techo  b> file1 &&\n\tgit add file1 &&\n\tgit commit -m b1 &&\n\tgit checkout a1 &&\n\tgit merge b1\n\nThe merge output is:\nMerging HEAD with b1\nMerging:\n3231a8a a\nace6b2d b1\nfound 1 common ancestor(s):\nf43806f initial\nCONFLICT (delete/modify): file1 deleted in HEAD and modified in b1.\nVersion b1 of file1 left in tree.\nAutomatic merge failed; fix conflicts and then commit the result.\n\n$ git ls-files -s\n100644 78981922613b2afb6025042ff6bd878ac1994e85 1       file1\n100644 61780798228d17af2d34fce4cfbdf35556832472 3       file1\n\n$ git diff [-1 | -2 | -3]\n* Unmerged path file1\n\n$ git diff --merge\ndiff --cc file1\nindex 6178079,0000000..7898192\nmode 100644,000000..100644\n--- a/file1\n+++ b/file1\n@@@ -1,1 -1,0 +1,1 @@@\n- b\n++a\n\nthat does not make sense.\n\nMaybe something as?\n\n$ git diff\ndiff --cc file1\nindex 0000000,6178079..0000000\nmode 000000,100644..0000000\n--- /dev/null\n+++ b/file1\n\nBut I don't really know what to expect in this case.\n\nSanti\n"},{"id":"75147","messageId":"8aa486160804240608m702ba3b5he8277a0982730d61@mail.gmail.com","threadId":"13207","inReplyTo":"8aa486160804240551y1d1e412cvb6801e652026f832@mail.gmail.com","subject":"Re: showing conflicting merges","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-24T13:08:44Z","receivedAt":"2008-04-24T13:08:44Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Thu, Apr 24, 2008 at 2:51 PM, Santi Béjar <sbejar@gmail.com> wrote:\n> On Wed, Apr 23, 2008 at 8:17 AM, Uwe Kleine-König\n>\n> <Uwe.Kleine-Koenig@digi.com> wrote:\n>  > Hello Santi,\n>  >\n>  >\n>  >  Santi Béjar wrote:\n>  >  > On Tue, Apr 22, 2008 at 11:12 AM, Uwe Kleine-König\n>  >  > <Uwe.Kleine-Koenig@digi.com> wrote:\n>  >  > > Hello,\n>  >  > >\n>  >  > >  There is a thread on the linux-arm-kernel ML that discusses handling of\n>  >  > >  merge conflicts with git.[1]\n>  >  > >\n>  >  > >  I played around a bit with that and wondered about a few things:\n>  >  > >\n>  >  > >         ukleinek@zentaur:~/gsrc/linux-2.6$ git checkout -b test adf6d34e460387ee3e8f1e1875d\n>  >  > >         Switched to a new branch \"test\"\n>  >  > >\n>  >  > >         ukleinek@zentaur:~/gsrc/linux-2.6$ git merge v2.6.25\n>  >  > >         Auto-merged MAINTAINERS\n>  >  > >         CONFLICT (delete/modify): drivers/leds/leds-tosa.c deleted in HEAD and modified in v2.6.25. Version v2.6.25 of drivers/leds/leds-tosa.c left in tree.\n>  >  > >         Auto-merged drivers/serial/imx.c\n>  >  > >         Automatic merge failed; fix conflicts and then commit the result.\n>  >  > >\n>  >  > >  Now \"git diff --merge\" shows:\n>  >  > >\n>  >  > >         diff --cc drivers/leds/leds-tosa.c\n>  >  > >         index 7ebecc4,0000000..9e0a188\n>  >  > >         ...\n>  >  > >\n>  >  > >  Shouldn't that better be reversed, i.e. 9e0a188..7ebecc4,0000000?\n>  >  >\n>  >  > It compares the versions in conflict with the version in the working copy.\n>  >\n>  >  I have not checked in the source code, but the output of\n>  >\n>  >         strace -f -e open git diff --merge 2>&1 >/dev/null | grep leds-tosa\n>  >\n>  >  seems to contradict that (i.e. there is no output).\n>\n>  The version in the working copy should be 7ebecc4, so there is no need\n>  to open it as it is in the index (but maybe I'm wrong).\n>\n>\n>  >\n>  >         7ebecc4 = v2.6.25:drivers/leds/leds-tosa.c\n>  >         9e0a188 = $(git merge-base test v2.6.25):drivers/leds/leds-tosa.c\n>  >\n>  >  (Ah, I just see, that's another hint that diff --merge doesn't look in\n>  >  the working copy.  The wc has 7ebecc4 which is in the LHS together with\n>  >  000000 (i.e. the deleted file from HEAD).\n>  >\n>  >  Maybe the combined diff format cannot have more than one rev on the RHS?\n>  >\n>  >\n>\n>  FWIU --merge is an option for git-rev-list (and alike, git log,\n>  gitk...). I don't know its meaning in this case. It shoud be juts:\n>\n>  $git diff\n>\n>  that currently says in this case:\n>\n>  $ git diff\n>  * Unmerged path file1\n>\n>  In this case:\n>\n>         echo a >file1 &&\n>         git add file1 &&\n>         git commit -m initial &&\n>         git checkout -b a1 master &&\n>         git rm file1 &&\n>         git commit -m a &&\n>         git checkout -b b1 master &&\n>         echo  b> file1 &&\n>         git add file1 &&\n>         git commit -m b1 &&\n>         git checkout a1 &&\n>         git merge b1\n>\n>  The merge output is:\n>  Merging HEAD with b1\n>  Merging:\n>  3231a8a a\n>  ace6b2d b1\n>  found 1 common ancestor(s):\n>  f43806f initial\n>  CONFLICT (delete/modify): file1 deleted in HEAD and modified in b1.\n>  Version b1 of file1 left in tree.\n>\n> Automatic merge failed; fix conflicts and then commit the result.\n>\n>  $ git ls-files -s\n>  100644 78981922613b2afb6025042ff6bd878ac1994e85 1       file1\n>  100644 61780798228d17af2d34fce4cfbdf35556832472 3       file1\n>\n>  $ git diff [-1 | -2 | -3]\n>  * Unmerged path file1\n\nActually only:\ngit diff\ngit diff -2\ngit diff -3\n\nfor:\n$ git diff -1\n* Unmerged path file1\ndiff --git a/file1 b/file1\nindex 7898192..c9c6af7 100644\n--- a/file1\n+++ b/file1\n@@ -1 +1 @@\n-a\n+b1\n\nbut \"-2\" and \"-3\" do the same for different reasons\n\n-2) theres is no \"2\" in the index\n-3) is equal to the wc file1\n\nso both output the same:\n* Unmerged path file1\n\nand I still think \"git diff\" has to output something else than\n\"*Unmerged path file1\".\n\n>\n>  $ git diff --merge\n>  diff --cc file1\n>  index 6178079,0000000..7898192\n>  mode 100644,000000..100644\n>  --- a/file1\n>  +++ b/file1\n>  @@@ -1,1 -1,0 +1,1 @@@\n>  - b\n>  ++a\n>\n>  that does not make sense.\n>\n>  Maybe something as?\n>\n>  $ git diff\n>  diff --cc file1\n>  index 0000000,6178079..0000000\n>  mode 000000,100644..0000000\n>  --- /dev/null\n>  +++ b/file1\n>\n>  But I don't really know what to expect in this case.\n>\n>  Santi\n>\n"}]}