{"thread":{"id":"28061","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","startedAt":"2011-08-10T16:12:11Z","lastAt":"2011-08-11T09:48:01Z","messageCount":7,"participants":["Jonathan Nieder","Tanguy Ortolo","Sebastian Schuberth","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"173245","messageId":"20110810161211.GC4076@elie.gateway.2wire.net","threadId":"28061","inReplyTo":"20110810160356.GA32126@ortolo.eu","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-10T16:12:11Z","receivedAt":"2011-08-10T16:12:11Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+cc: some relevant people)\nHi,\n\nTanguy Ortolo wrote[1]:\n\n> git-mergetool ideally uses tools that work with 4 files: BASE, LOCAL,\n> REMOTE, which are the usual original and two new version of the file,\n> and MERGED, which is where the tool is supposed to write the result of\n> the merge.\n>\n> The problem is that most tools, at least graphical ones, specifically\n> meld, can only work with three files, as they save the result to the\n> original file.\n>\n> git-mergetool currently handles this situation by passing MERGED LOCAL\n> REMOTE to the tool. This could be fine, but unfortunately MERGE contains\n> the conflicts, formatted for manual resolution, so it is not really\n> appropriate as an original file.\n>\n> I think it would be better to wrap such merge tools by:\n> 1. passing them BASE LOCAL REMOTE;\n> 2. checking whether or not BASE hase been modified:\n>    * if it has, then copying it to MERGED,\n>    * if it has not, exiting with return code 1 (merge failed).\n> This check can be by either saving and comparing the mdate, or perhaps\n> the SHA-1 hash of the BASE file.\n>\n> If this sounds good enough, I can dive into git-mergetoo--lib and\n> implement it. In the meantime, here is an example of a custom merge tool\n> that wraps meld for that purpose.\n\nI think you forgot to include the example.  Anyway, at first glance it\nsounds like a sensible idea.  David et al: thoughts?\n\nRegards,\nJonathan\n\n[1] http://bugs.debian.org/637355\n"},{"id":"173247","messageId":"20110810172458.GA18167@ortolo.eu","threadId":"28061","inReplyTo":"20110810161211.GC4076@elie.gateway.2wire.net","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"Tanguy Ortolo","fromEmail":"tanguy+debian@ortolo.eu","sentAt":"2011-08-10T17:24:59Z","receivedAt":"2011-08-10T17:24:59Z","isPatch":false,"sender":{"key":"tanguy+debian@ortolo.eu","avatar":null},"body":"Jonathan Nieder, 2011-08-10 11:12 UTC-0500:\n> I think you forgot to include the example.\n\nYes, sorry. Here it is.\n\n-- \nTanguy Ortolo\n\n\n#! /bin/sh\n\nBASE=\"$1\"\nLOCAL=\"$2\"\nREMOTE=\"$3\"\nMERGED=\"$4\"\n\nMTIME_BEFORE=\"$(stat --format='%Y' \"$BASE\")\"\nmeld \"$LOCAL\" \"$BASE\" \"$REMOTE\"\nMTIME_AFTER=\"$(stat --format=\"%Y\" \"$BASE\")\"\n\nif [ \"$MTIME_BEFORE\" != \"$MTIME_AFTER\" ]\nthen\n    # The base file was modified, which means the user saved it\n    cp \"$BASE\" \"$MERGED\"\nelse\n    # The user did not save the file: merge failed\n    exit 1\nfi\n"},{"id":"173248","messageId":"CAHGBnuP5hZ_GJ-ZCwDUVttXvZqsrTh7yXjJCZUoMgVEwVrYjjw@mail.gmail.com","threadId":"28061","inReplyTo":"20110810161211.GC4076@elie.gateway.2wire.net","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2011-08-10T19:23:43Z","receivedAt":"2011-08-10T19:23:43Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Wed, Aug 10, 2011 at 18:12, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> I think it would be better to wrap such merge tools by:\n>> 1. passing them BASE LOCAL REMOTE;\n>> 2. checking whether or not BASE hase been modified:\n>>    * if it has, then copying it to MERGED,\n>>    * if it has not, exiting with return code 1 (merge failed).\n>> This check can be by either saving and comparing the mdate, or perhaps\n>> the SHA-1 hash of the BASE file.\n>>\n>> If this sounds good enough, I can dive into git-mergetoo--lib and\n>> implement it. In the meantime, here is an example of a custom merge tool\n>> that wraps meld for that purpose.\n>\n> I think you forgot to include the example.  Anyway, at first glance it\n> sounds like a sensible idea.  David et al: thoughts?\n\nSounds sensible to me, too. (Although I'm not affected, as fortunately\nthe GUI merge tools I've been using so far, namely ECMerge and Beyond\nCompare 3, both allow to specify a separate merge output.)\n\n-- \nSebastian Schuberth\n"},{"id":"173264","messageId":"20110811083835.GA29507@gmail.com","threadId":"28061","inReplyTo":"20110810161211.GC4076@elie.gateway.2wire.net","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-08-11T08:38:38Z","receivedAt":"2011-08-11T08:38:38Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, Aug 10, 2011 at 11:12:11AM -0500, Jonathan Nieder wrote:\n> (+cc: some relevant people)\n> Hi,\n> \n> Tanguy Ortolo wrote[1]:\n> \n> > git-mergetool ideally uses tools that work with 4 files: BASE, LOCAL,\n> > REMOTE, which are the usual original and two new version of the file,\n> > and MERGED, which is where the tool is supposed to write the result of\n> > the merge.\n> >\n> > The problem is that most tools, at least graphical ones, specifically\n> > meld, can only work with three files, as they save the result to the\n> > original file.\n> >\n> > git-mergetool currently handles this situation by passing MERGED LOCAL\n> > REMOTE to the tool. This could be fine, but unfortunately MERGE contains\n> > the conflicts, formatted for manual resolution, so it is not really\n> > appropriate as an original file.\n> >\n> > I think it would be better to wrap such merge tools by:\n> > 1. passing them BASE LOCAL REMOTE;\n> > 2. checking whether or not BASE hase been modified:\n> >    * if it has, then copying it to MERGED,\n> >    * if it has not, exiting with return code 1 (merge failed).\n> > This check can be by either saving and comparing the mdate, or perhaps\n> > the SHA-1 hash of the BASE file.\n> >\n> > If this sounds good enough, I can dive into git-mergetoo--lib and\n> > implement it. In the meantime, here is an example of a custom merge tool\n> > that wraps meld for that purpose.\n> \n> I think you forgot to include the example.  Anyway, at first glance it\n> sounds like a sensible idea.  David et al: thoughts?\n\nI think it sounds like a good thing for certain tools.\nSebastian mentioned it being fine in ecmerge and bc3.\nxxdiff also lets you specify the output file, so it\nprobably wouldn't need it either, I think.\n\nIf the patch touches individual tools that need it, e.g. meld,\nI say go for it.\n\n> Regards,\n> Jonathan\n> \n> [1] http://bugs.debian.org/637355\n\ncheers,\n-- \n\t\t\t\t\tDavid\n"},{"id":"173265","messageId":"20110811084955.GA31233@elie.gateway.2wire.net","threadId":"28061","inReplyTo":"20110811083835.GA29507@gmail.com","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-08-11T08:49:55Z","receivedAt":"2011-08-11T08:49:55Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"David Aguilar wrote:\n\n> I think it sounds like a good thing for certain tools.\n> Sebastian mentioned it being fine in ecmerge and bc3.\n> xxdiff also lets you specify the output file, so it\n> probably wouldn't need it either, I think.\n\nAt the risk of taking away the itch for a good feature: meld joined\nthe crowd of tools with -o to specify an output file in v1.5.0.\n\n http://thread.gmane.org/gmane.comp.gnome.meld.general/1270\n"},{"id":"173270","messageId":"20110811093731.GB29507@gmail.com","threadId":"28061","inReplyTo":"20110811084955.GA31233@elie.gateway.2wire.net","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-08-11T09:37:32Z","receivedAt":"2011-08-11T09:37:32Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Thu, Aug 11, 2011 at 03:49:55AM -0500, Jonathan Nieder wrote:\n> David Aguilar wrote:\n> \n> > I think it sounds like a good thing for certain tools.\n> > Sebastian mentioned it being fine in ecmerge and bc3.\n> > xxdiff also lets you specify the output file, so it\n> > probably wouldn't need it either, I think.\n> \n> At the risk of taking away the itch for a good feature: meld joined\n> the crowd of tools with -o to specify an output file in v1.5.0.\n> \n>  http://thread.gmane.org/gmane.comp.gnome.meld.general/1270\n\nWhat's the best way to use this and not break existing users?\n\nmeld v1.5.0 was released in December.\nWe could parse `meld --version` and use the new --output flag on\nnewer setups, leaving old setups alone.  That's a lot of\ncode to carry around but it's nicest to users.\n\nHere's another idea..\nmergetool--lib has vimdiff and vimdiff2.  Maybe we can add a new\nmeld3 tool that uses the --output flag?  Users with older setups\nare unaffected. Documentation is changed to mention meld v1.5.0\nand the meld3 tool.  New users have to configure :-/\n\nAlternatively, rename the existing meld to meld2 and let the\nnew style call take over the current meld tool.\nOlder setups with new git that use meld can adjust their\nconfig.\n\n(and the final option: refactor mergetool--lib into separate\n files.  Yes, we should do that too! ;-))\n\nwhat do you think?\n-- \n\t\t\t\t\tDavid\n"},{"id":"173271","messageId":"CAHGBnuM=nadYNOH8rPzenttYmNwyz04FsPyvavWD1UDUbF4v8A@mail.gmail.com","threadId":"28061","inReplyTo":"20110811093731.GB29507@gmail.com","subject":"Re: git-mergetool: wrap tools with 3 files only to use the BASE file instead of MERGED","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2011-08-11T09:48:01Z","receivedAt":"2011-08-11T09:48:01Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Thu, Aug 11, 2011 at 11:37, David Aguilar <davvid@gmail.com> wrote:\n\n> What's the best way to use this and not break existing users?\n>\n> meld v1.5.0 was released in December.\n> We could parse `meld --version` and use the new --output flag on\n> newer setups, leaving old setups alone.  That's a lot of\n> code to carry around but it's nicest to users.\n\nI'd definitely prefer this solution, as it's the most convenient for users.\n\n-- \nSebastian Schuberth\n"}]}