{"thread":{"id":"24182","subject":"Confusion about content of conflicted file after : git remove/add","startedAt":"2010-06-24T04:53:49Z","lastAt":"2010-06-26T05:58:12Z","messageCount":4,"participants":["Sabyasachi Ruj","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144119","messageId":"AANLkTimqrfeNEmlfHGxWTdLgS7tAMOA66N4nV8b5I8F6@mail.gmail.com","threadId":"24182","inReplyTo":null,"subject":"Confusion about content of conflicted file after : git remove/add","fromName":"Sabyasachi Ruj","fromEmail":"ruj.sabya@gmail.com","sentAt":"2010-06-24T04:53:49Z","receivedAt":"2010-06-24T04:53:49Z","isPatch":false,"sender":{"key":"ruj.sabya@gmail.com","avatar":"https://gravatar.com/avatar/d6ca171222ef790f70142465c2987175fff15e3039b0bdd9e5f382dab051eadf?d=mp&s=160"},"body":"I have asked the question in detail in Stack Overflow.\nhttp://stackoverflow.com/questions/3100032/git-rename-delete-confusion\nCan anyone here explain that situation. Please also read the comments\nI wrote there.\n\nI am totally baffled and can't predict what will be the content of a\nfile after \"git rm and git add\" in branch and \"git mv\" in another\nbranch.\n\n--\nSabyasachi\n"},{"id":"144120","messageId":"20100624061029.GA11020@coredump.intra.peff.net","threadId":"24182","inReplyTo":"AANLkTimqrfeNEmlfHGxWTdLgS7tAMOA66N4nV8b5I8F6@mail.gmail.com","subject":"Re: Confusion about content of conflicted file after : git remove/add","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-06-24T06:10:29Z","receivedAt":"2010-06-24T06:10:29Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 24, 2010 at 10:23:49AM +0530, Sabyasachi Ruj wrote:\n\n> I have asked the question in detail in Stack Overflow.\n> http://stackoverflow.com/questions/3100032/git-rename-delete-confusion\n> Can anyone here explain that situation. Please also read the comments\n> I wrote there.\n> \n> I am totally baffled and can't predict what will be the content of a\n> file after \"git rm and git add\" in branch and \"git mv\" in another\n> branch.\n\nThose two actions are the same. So there would be no conflict. But in\nthe situation you gave at stackoverflow, it is not just \"git rm and git\nadd\" versus \"git mv\". On one side, you actually change the file entirely\n(well beyond what any rename detection could guess at, as you rewrite\nthe single line in the file).\n\nSo your situation is \"moved file\" versus \"moved and changed file\". You\nget a rename/delete conflict because one side renamed the file, but the\nother side apparently deleted it (because we cannot link the old \"a\" to\nthe new \"b\", as they are too different).\n\nWe seem to mark this in the index as:\n\n  1. \"a\" is totally gone. This makes some sense, as it did go away on\n     both sides, but given that it is part of a conflict-causing rename,\n     I wonder if it should simply stay.\n\n  2. We mark \"b\" as unmerged, but only put the \"renamed to\" entry in\n     stage 3. For a pure rename/delete conflict, this makes sense. But\n     this _isn't_ purely that. We also add \"b\" on our branch, so there\n     should be a further rename/add conflict, but we never see it. At\n     the very least, the new contents of \"b\" should go into stage 2 of\n     the index.\n\nSo I think there may be a bug. I don't really see any code in\nmerge-recursive.c to handle conflicts on _both_ sides of a rename, but\nobviously that is possible here.\n\n-Peff\n"},{"id":"144223","messageId":"AANLkTinQu19HKUC2a_JkSyeZ_SynE11eNwgH9zEMiY8g@mail.gmail.com","threadId":"24182","inReplyTo":"AANLkTilo0b9aL3oxk0b8eNkBWygwA7xSclTy1MaK8qba@mail.gmail.com","subject":"Re: Confusion about content of conflicted file after : git remove/add","fromName":"Sabyasachi Ruj","fromEmail":"ruj.sabya@gmail.com","sentAt":"2010-06-25T05:36:46Z","receivedAt":"2010-06-25T05:36:46Z","isPatch":false,"sender":{"key":"ruj.sabya@gmail.com","avatar":"https://gravatar.com/avatar/d6ca171222ef790f70142465c2987175fff15e3039b0bdd9e5f382dab051eadf?d=mp&s=160"},"body":">> So I think there may be a bug. I don't really see any code in\n>> merge-recursive.c to handle conflicts on _both_ sides of a rename, but\n>> obviously that is possible here.\n\nThen I guess having contents of both the files would be an expected\nbehavior. Should I report a bug somewhere?\n-\nSabyasachi\n"},{"id":"144284","messageId":"20100626055812.GA10290@coredump.intra.peff.net","threadId":"24182","inReplyTo":"AANLkTinQu19HKUC2a_JkSyeZ_SynE11eNwgH9zEMiY8g@mail.gmail.com","subject":"Re: Confusion about content of conflicted file after : git remove/add","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-06-26T05:58:12Z","receivedAt":"2010-06-26T05:58:12Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jun 25, 2010 at 11:06:46AM +0530, Sabyasachi Ruj wrote:\n\n> >> So I think there may be a bug. I don't really see any code in\n> >> merge-recursive.c to handle conflicts on _both_ sides of a rename, but\n> >> obviously that is possible here.\n> \n> Then I guess having contents of both the files would be an expected\n> behavior. Should I report a bug somewhere?\n\nI would certainly expect it (at least in the index). Posting here is\nfine to report, but you may want to repost with a more descriptive\nsubject line and a summary of the issue. That will get the attention of\npeople interested in merge issues.\n\n-Peff\n"}]}