{"thread":{"id":"17982","subject":"how do I resolve this merge manually + mergetool bug","startedAt":"2009-02-24T06:04:23Z","lastAt":"2009-02-24T09:13:30Z","messageCount":8,"participants":["Caleb Cushing","Junio C Hamano","Charles Bailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"105979","messageId":"81bfc67a0902232204y7a1e9a91x6cbf751319664734@mail.gmail.com","threadId":"17982","inReplyTo":null,"subject":"how do I resolve this merge manually + mergetool bug","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-02-24T06:04:23Z","receivedAt":"2009-02-24T06:04:23Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"#       unmerged:   profiles/package.mask\n\non the remote package.mask is a file locally it is a directory.\n\nI need to know how I can resolve this merge without mergetool as\ncurrently mergetool doesn't handle it well.\n\nI want to delete the remote version of package.mask\n\ntried:\n\ngit rm :3:profiles/package.mask\nfatal: pathspec ':3:profiles/package.mask' did not match any files\n\nmergetool will move my directory to a backup directory if I tell it to\ndelete package.mask it doesn't move the directory back into place, if\nI tell it to use the remote version it obviously copies it into\nplace... I'd be ok if when I told it to delete it, it restored the\ndirectory from backup.\n\nregardless of mergetools problems I'd like to know how to fix this\nmerge without mergetool.\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"},{"id":"105983","messageId":"7vbpssmjm9.fsf@gitster.siamese.dyndns.org","threadId":"17982","inReplyTo":"81bfc67a0902232204y7a1e9a91x6cbf751319664734@mail.gmail.com","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-24T06:31:10Z","receivedAt":"2009-02-24T06:31:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Caleb Cushing <xenoterracide@gmail.com> writes:\n\n> #       unmerged:   profiles/package.mask\n>\n> on the remote package.mask is a file locally it is a directory.\n> ...\n> git rm :3:profiles/package.mask\n> fatal: pathspec ':3:profiles/package.mask' did not match any files\n\nThe answer most likely is this but don't do this just yet:\n\n    $ git rm profiles/package.mask\n\nWith this, you are saying \"For the path profiles/package.mask, the correct\nresolution is not to have it\".  There is no room for the stage number to\nget into the picture when you are talking about the final result.\n\nBut I am suspecting that this is because you moved it to somewhere\n(perhaps to profiles/package.mask/frotz) while the remote side kept it\nintact or modified it in place.  If that is the case, and if the remote\nside made an in-place change, you would want to port the change over to\nthe path you moved the contents to before you actually remove it, so\nbefore running the above \"git rm\", I would do something like.\n\n    $ git cat-file blob :1:profiles/package.mask >original\n    $ git cat-file blob :3:profiles/package.mask >theirs\n    $ git cat-file blob profiles/package.mask/frotz >mine\n    $ git merge-file mine original theirs\n    $ diff -u profiles/package.mask/frotz mine ;# eyeball the merge result\n    $ cat mine >profiles/package.mask/frotz\n\nand then finally conclude the merge with:\n\n    $ git rm profiles/package.mask\n    $ git add profiles/package.mask/frotz\n\nBut if the remote side did not change anything (i.e. original == theirs),\nthen you do not have to do the file-level merge to update the contents you\nmoved to a different path.\n"},{"id":"105987","messageId":"81bfc67a0902232252h56570308r22872854af8da54a@mail.gmail.com","threadId":"17982","inReplyTo":"7vbpssmjm9.fsf@gitster.siamese.dyndns.org","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-02-24T06:52:59Z","receivedAt":"2009-02-24T06:52:59Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"On Tue, Feb 24, 2009 at 1:31 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>    $ git cat-file blob :1:profiles/package.mask >original\n>    $ git cat-file blob :3:profiles/package.mask >theirs\n>    $ git cat-file blob profiles/package.mask/frotz >mine\n>    $ git merge-file mine original theirs\n>    $ diff -u profiles/package.mask/frotz mine ;# eyeball the merge result\n>    $ cat mine >profiles/package.mask/frotz\n\nso do all this if theirs is different? (at the moment I know it isn't)\n\n> and then finally conclude the merge with:\n>\n>    $ git rm profiles/package.mask\n>    $ git add profiles/package.mask/frotz\n\ngit rm profiles/package.mask\n\nrm 'profiles/package.mask'\nrm 'profiles/package.mask'\nrm 'profiles/package.mask/gentoo.org'\nrm 'profiles/package.mask/java-overlay'\nrm 'profiles/package.mask/perl-experimental'\nrm 'profiles/package.mask/regen2.org'\nrm 'profiles/package.mask/sunrise'\nfatal: git rm: profiles/package.mask: Is a directory\n\nand git status still shows..\n\n#       unmerged:   profiles/package.mask\n\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"},{"id":"105994","messageId":"7vr61ol2yn.fsf@gitster.siamese.dyndns.org","threadId":"17982","inReplyTo":"81bfc67a0902232252h56570308r22872854af8da54a@mail.gmail.com","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-24T07:16:16Z","receivedAt":"2009-02-24T07:16:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Caleb Cushing <xenoterracide@gmail.com> writes:\n\n> git rm profiles/package.mask\n>\n> rm 'profiles/package.mask'\n> rm 'profiles/package.mask'\n> rm 'profiles/package.mask/gentoo.org'\n\nAhh, ok, \"git rm\" Porcelain may well be buggy; I almost never use it\nmyself.\n\n\"git update-index --force-remove profiles/package.mask\" should work\nbetter.  I tend to trust plumbing a lot more than Porcelain for these\ncorner cases.\n"},{"id":"105995","messageId":"81bfc67a0902232319t7525e3b3n74b667257024800b@mail.gmail.com","threadId":"17982","inReplyTo":"7vr61ol2yn.fsf@gitster.siamese.dyndns.org","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-02-24T07:19:32Z","receivedAt":"2009-02-24T07:19:32Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"On Tue, Feb 24, 2009 at 2:16 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"git update-index --force-remove profiles/package.mask\" should work\n> better.  I tend to trust plumbing a lot more than Porcelain for these\n> corner cases.\n\nworks. awesome! thanks for the help, I've been banging my head against\nhow to do this (without pain++ ) for a couple of days.\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"},{"id":"105996","messageId":"20090224074727.GA23927@hashpling.org","threadId":"17982","inReplyTo":"81bfc67a0902232204y7a1e9a91x6cbf751319664734@mail.gmail.com","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-02-24T07:47:27Z","receivedAt":"2009-02-24T07:47:27Z","isPatch":false,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Tue, Feb 24, 2009 at 01:04:23AM -0500, Caleb Cushing wrote:\n> regardless of mergetools problems I'd like to know how to fix this\n> merge without mergetool.\n\nI see you've now resolved this without mergetool, I'll look at adding\na test case to mergetool and see how easy it is to get it to handle\nthis case better.\n\n-- \nCharles Bailey\nhttp://ccgi.hashpling.plus.com/blog/\n"},{"id":"105998","messageId":"81bfc67a0902240032t783abcabgaf8fa13b2a43e48@mail.gmail.com","threadId":"17982","inReplyTo":"20090224074727.GA23927@hashpling.org","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Caleb Cushing","fromEmail":"xenoterracide@gmail.com","sentAt":"2009-02-24T08:32:50Z","receivedAt":"2009-02-24T08:32:50Z","isPatch":false,"sender":{"key":"xenoterracide@gmail.com","avatar":"https://gravatar.com/avatar/af3f0745dfa0ea9c4ee551d7d0a3cfe7ba8d229754c11678ab2ed23c3fa57065?d=mp&s=160"},"body":"On Tue, Feb 24, 2009 at 2:47 AM, Charles Bailey <charles@hashpling.org> wrote:\n> I'll look at adding\n> a test case to mergetool and see how easy it is to get it to handle\n> this case better.\n\nfew weeks back I created a patch for mergetool, it was rejected\nultimately on the basis that it had to cleanup temporary files and in\nreality this was a problem with a lot of mergetool, the suggestion was\nmade that mergetool needs refactoring. I believe this problem is a\nsimilar symptom. basically mergetool should touch my files before I\ntell it what to do. if it has to move and back up my files before\ndeciding then at the very least it should copy them back into place if\nI delete the remote. preferably in this case though it would just\ndelete the remote or backup my local files and copy the remote in\nafter I told it what to do (or maybe even delete my local files).\n-- \nCaleb Cushing\n\nhttp://xenoterracide.blogspot.com\n"},{"id":"106008","messageId":"20090224091330.GB23927@hashpling.org","threadId":"17982","inReplyTo":"81bfc67a0902240032t783abcabgaf8fa13b2a43e48@mail.gmail.com","subject":"Re: how do I resolve this merge manually + mergetool bug","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2009-02-24T09:13:30Z","receivedAt":"2009-02-24T09:13:30Z","isPatch":false,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Tue, Feb 24, 2009 at 03:32:50AM -0500, Caleb Cushing wrote:\n> On Tue, Feb 24, 2009 at 2:47 AM, Charles Bailey <charles@hashpling.org> wrote:\n> > I'll look at adding\n> > a test case to mergetool and see how easy it is to get it to handle\n> > this case better.\n> \n> few weeks back I created a patch for mergetool, it was rejected\n> ultimately on the basis that it had to cleanup temporary files and in\n> reality this was a problem with a lot of mergetool, the suggestion was\n> made that mergetool needs refactoring. I believe this problem is a\n> similar symptom. basically mergetool should touch my files before I\n> tell it what to do. if it has to move and back up my files before\n> deciding then at the very least it should copy them back into place if\n> I delete the remote. preferably in this case though it would just\n> delete the remote or backup my local files and copy the remote in\n> after I told it what to do (or maybe even delete my local files).\n\nCoincidentally, last night I started looking at a mergetool\nrefactoring but more with unifying the handling of temporaries and\nactions between the different types of merge (symlink, deleted file\nand 'normal').\n\nI'm more of the opinion that in any non-trivial case (i.e. not a\nregular file/file merge), it *shouldn't* do anything until you tell it\nwhat you want it to do. Clearly, between a tree and a blob, mergetool\nis not going to be able to invoke a mergetool on set of three blobs,\nbut it should work out what it can do before prompting for a choice\nfrom the user of what they want it to do.\n\n-- \nCharles Bailey\nhttp://ccgi.hashpling.plus.com/blog/\n"}]}