{"thread":{"id":"47376","subject":"submodule modify/delete wrong message","startedAt":"2017-12-04T21:39:46Z","lastAt":"2017-12-11T20:35:40Z","messageCount":3,"participants":["David Turner","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"334093","messageId":"1512423580.9882.405.camel@novalis.org","threadId":"47376","inReplyTo":null,"subject":"submodule modify/delete wrong message","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2017-12-04T21:39:40Z","receivedAt":"2017-12-04T21:39:46Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"When merging with a submodule modify/delete conflict (i.e. I've deleted\nthe submodule, and I'm merging in a branch that modified it), git lies\nabout what it is doing:\n\n\"CONFLICT (modify/delete): submodule deleted in HEAD and modified in\nsubmodules. Version submodules of submodule left in tree at\nsubmodule~submodules.\nAutomatic merge failed; fix conflicts and then commit the result.\"\n\nIn fact, the working tree does not contain anything named\n'submodule~submodules'.  \n\nIn addition, I would ordinarily resolve a conflict like this by using\n'git rm'. Here, this gives a warning:\n\n$ git rm submodule\nsubmodule: needs merge\nrm 'submodule'\nwarning: Could not find section in .gitmodules where path=submodule\n\nGit's behavior here is significantly better than liggit2's (which tries\nto check out 'submodule' as if it were a blob, and fails to do so), but\nit's still confusing.\n\nIt's not clear to me what the correct behavior is here.  Maybe it's\nsufficient to just fix the message?\n"},{"id":"334625","messageId":"CAGZ79kZVm7ZgnqBFnKd8L51Uy+5_7DOttUMAU=qofN3XXD94nQ@mail.gmail.com","threadId":"47376","inReplyTo":"1512423580.9882.405.camel@novalis.org","subject":"Re: submodule modify/delete wrong message","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-12-11T20:27:22Z","receivedAt":"2017-12-11T20:27:30Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Dec 4, 2017 at 1:39 PM, David Turner <novalis@novalis.org> wrote:\n> When merging with a submodule modify/delete conflict (i.e. I've deleted\n> the submodule, and I'm merging in a branch that modified it), git lies\n> about what it is doing:\n>\n> \"CONFLICT (modify/delete): submodule deleted in HEAD and modified in\n> submodules.\n\nUp to here the error message sounds correct, still?\n\n\n> Version submodules of submodule left in tree at\n> submodule~submodules.\n> Automatic merge failed; fix conflicts and then commit the result.\"\n\nThis sounds as if the code assumed to handle only files.\n\n> In fact, the working tree does not contain anything named\n> 'submodule~submodules'.\n>\n> In addition, I would ordinarily resolve a conflict like this by using\n> 'git rm'. Here, this gives a warning:\n>\n> $ git rm submodule\n> submodule: needs merge\n\n(Regarding submodule merges in general:)\n\nUh. We cannot add merge markers to a submodule or such.\nMore importantly we'd have to ask the question if the merge conflict\nis on the superproject level (Choose one of the commits of the submodule)\nor on the submodule level (perform a merge in the submodule between the\ntwo commits) or some hybrid approach thereof.\n\n> rm 'submodule'\n> warning: Could not find section in .gitmodules where path=submodule\n\nThe deletion of the submodule removed the .gitmodules entry, and the\nmerge of the .gitmodules file presumably went fine. :/\n\nI assume we need a special merge driver for the .gitmodules file to keep\nthe submodule around when it is in at least one side.\n\n> Git's behavior here is significantly better than liggit2's (which tries\n> to check out 'submodule' as if it were a blob, and fails to do so), but\n> it's still confusing.\n>\n> It's not clear to me what the correct behavior is here.  Maybe it's\n> sufficient to just fix the message?\n\nI think the first step is to fix the message to reflect reality.\n\nAs alluded to above, I don't know what the correct merge\nbehavior is (and where to put 'conflict markers').\n\nStefan\n"},{"id":"334627","messageId":"1513024524.10716.8.camel@novalis.org","threadId":"47376","inReplyTo":"CAGZ79kZVm7ZgnqBFnKd8L51Uy+5_7DOttUMAU=qofN3XXD94nQ@mail.gmail.com","subject":"Re: submodule modify/delete wrong message","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2017-12-11T20:35:24Z","receivedAt":"2017-12-11T20:35:40Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"On Mon, 2017-12-11 at 12:27 -0800, Stefan Beller wrote:\n> On Mon, Dec 4, 2017 at 1:39 PM, David Turner <novalis@novalis.org>\n> wrote:\n> > When merging with a submodule modify/delete conflict (i.e. I've\n> > deleted\n> > the submodule, and I'm merging in a branch that modified it), git\n> > lies\n> > about what it is doing:\n> > \n> > \"CONFLICT (modify/delete): submodule deleted in HEAD and modified\n> > in\n> > submodules.\n> \n> Up to here the error message sounds correct, still?\n\nYep!\n\n> > Version submodules of submodule left in tree at\n> > submodule~submodules.\n> > Automatic merge failed; fix conflicts and then commit the result.\"\n> \n> This sounds as if the code assumed to handle only files.\n\nThis assumption is unfortunately very common -- I just filed a PR to\nfix an instance of this in libgit2.\n\n> > In fact, the working tree does not contain anything named\n> > 'submodule~submodules'.\n> > \n> > In addition, I would ordinarily resolve a conflict like this by\n> > using\n> > 'git rm'. Here, this gives a warning:\n> > \n> > $ git rm submodule\n> > submodule: needs merge\n> \n> (Regarding submodule merges in general:)\n> \n> Uh. We cannot add merge markers to a submodule or such.\n> More importantly we'd have to ask the question if the merge conflict\n> is on the superproject level (Choose one of the commits of the\n> submodule)\n> or on the submodule level (perform a merge in the submodule between\n> the\n> two commits) or some hybrid approach thereof.\n\nYeah, that's a tricky thing in general.  In this case, tho, the\nsubmodule is being removed, so git rm should work.\n\n> > rm 'submodule'\n> > warning: Could not find section in .gitmodules where path=submodule\n> \n> The deletion of the submodule removed the .gitmodules entry, and the\n> merge of the .gitmodules file presumably went fine. :/\n\nIndeed.\n\n> I assume we need a special merge driver for the .gitmodules file to\n> keep\n> the submodule around when it is in at least one side.\n> \n> > Git's behavior here is significantly better than liggit2's (which\n> > tries\n> > to check out 'submodule' as if it were a blob, and fails to do so),\n> > but\n> > it's still confusing.\n> > \n> > It's not clear to me what the correct behavior is here.  Maybe it's\n> > sufficient to just fix the message?\n> \n> I think the first step is to fix the message to reflect reality.\n> \n> As alluded to above, I don't know what the correct merge\n> behavior is (and where to put 'conflict markers').\n\nThe only case we need 'conflict markers' is in the\n{add,modify}/{add,modify} case (with different versions on each side). \nThe delete/* and */delete case can be handled more simply.  We might\nnot want to do this until we can handle all cases -- but personally, I\nthink a half-solution is better than a non-solution.\n\n"}]}