{"thread":{"id":"39379","subject":"[PATCH v4] mergetools: add winmerge as a builtin tool","startedAt":"2015-05-20T07:42:02Z","lastAt":"2015-05-20T20:03:36Z","messageCount":4,"participants":["David Aguilar","Sebastian Schuberth","Junio C Hamano"],"isPatch":true,"patchVersion":4,"patchTotal":null},"messages":[{"id":"261641","messageId":"1432107722-98613-1-git-send-email-davvid@gmail.com","threadId":"39379","inReplyTo":null,"subject":"[PATCH v4] mergetools: add winmerge as a builtin tool","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2015-05-20T07:42:02Z","receivedAt":"2015-05-20T07:42:02Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Add a winmerge scriptlet with the commands described in [1] so\nthat users can use winmerge without needing to perform any\nadditional configuration.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/268631\n\nHelped-by: Philip Oakley <philipoakley@iee.org>\nHelped-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nHelped-by: Sebastian Schuberth <sschuberth@gmail.com>\nHelped-by: SZEDER Gábor <szeder@ira.uka.de>\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nChanges since v3:\n\n* \"type -p\" is used instead of \"type\".\n* printf is consistently used instead of echo.\n* an env | grep pipeline is used to get the variables instead of hard-coding\n  a set of variables in the script, as suggested by Sebastian in\n  http://thread.gmane.org/gmane.comp.version-control.git/269437/focus=269441\n\n mergetools/winmerge | 45 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 45 insertions(+)\n create mode 100644 mergetools/winmerge\n\ndiff --git a/mergetools/winmerge b/mergetools/winmerge\nnew file mode 100644\nindex 0000000..fc364c769\n--- /dev/null\n+++ b/mergetools/winmerge\n@@ -0,0 +1,45 @@\n+diff_cmd () {\n+\t\"$merge_tool_path\" -u -e \"$LOCAL\" \"$REMOTE\"\n+\treturn 0\n+}\n+\n+merge_cmd () {\n+\t# mergetool.winmerge.trustExitCode is implicitly false.\n+\t# touch $BACKUP so that we can check_unchanged.\n+\ttouch \"$BACKUP\"\n+\t\"$merge_tool_path\" -u -e -dl Local -dr Remote \\\n+\t\t\"$LOCAL\" \"$REMOTE\" \"$MERGED\"\n+\tcheck_unchanged\n+}\n+\n+translate_merge_tool_path() {\n+\t# Use WinMergeU.exe if it exists in $PATH\n+\tif type -p WinMergeU.exe >/dev/null 2>&1\n+\tthen\n+\t\tprintf WinMergeU.exe\n+\t\treturn\n+\tfi\n+\n+\t# Look for WinMergeU.exe in the typical locations\n+\twinmerge_exe=\"WinMerge/WinMergeU.exe\"\n+\tfound=false\n+\tOIFS=$IFS\n+\tIFS='\n+'\n+\tfor directory in $(env | grep -Ei '^PROGRAM(FILES(\\(X86\\))?|W6432)=' |\n+\t\tcut -d '=' -f 2- | sort -u)\n+\tdo\n+\t\tif test -n \"$directory\" && test -x \"$directory/$winmerge_exe\"\n+\t\tthen\n+\t\t\tfound=true\n+\t\t\tprintf '%s' \"$directory/$winmerge_exe\"\n+\t\t\tbreak\n+\t\tfi\n+\tdone\n+\tIFS=$OIFS\n+\n+\tif test \"$found\" != true\n+\tthen\n+\t\tprintf WinMergeU.exe\n+\tfi\n+}\n-- \n2.4.1.218.gc09a0e5\n"},{"id":"261642","messageId":"CAHGBnuMCvzBYRYgLxz-5QJ5x8Quhw6byf+cGteRXQzpU65B+Jg@mail.gmail.com","threadId":"39379","inReplyTo":"1432107722-98613-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH v4] mergetools: add winmerge as a builtin tool","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2015-05-20T07:47:56Z","receivedAt":"2015-05-20T07:47:56Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Wed, May 20, 2015 at 9:42 AM, David Aguilar <davvid@gmail.com> wrote:\n\n> +       OIFS=$IFS\n> +       IFS='\n> +'\n\nI guess this is just a formatting issue with the mail export as it should read\n\nIFS=$'\\n'\n\nOtherwise looks good to me.\n\n-- \nSebastian Schuberth\n"},{"id":"261645","messageId":"20150520085346.GA99001@gmail.com","threadId":"39379","inReplyTo":"CAHGBnuMCvzBYRYgLxz-5QJ5x8Quhw6byf+cGteRXQzpU65B+Jg@mail.gmail.com","subject":"Re: [PATCH v4] mergetools: add winmerge as a builtin tool","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2015-05-20T08:53:48Z","receivedAt":"2015-05-20T08:53:48Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, May 20, 2015 at 09:47:56AM +0200, Sebastian Schuberth wrote:\n> On Wed, May 20, 2015 at 9:42 AM, David Aguilar <davvid@gmail.com> wrote:\n> \n> > +       OIFS=$IFS\n> > +       IFS='\n> > +'\n> \n> I guess this is just a formatting issue with the mail export as it should read\n> \n> IFS=$'\\n'\n> \n> Otherwise looks good to me.\n> \n> -- \n> Sebastian Schuberth\n\nThanks for the review.\n\nThat's actually a literal newline inside a single-quoted string.\n\nI'm not sure how portable $'\\n' is, but the '<literal-newline>'\napproach is used often in the git code.\n-- \nDavid\n"},{"id":"261706","messageId":"xmqq1tibnhif.fsf@gitster.dls.corp.google.com","threadId":"39379","inReplyTo":"20150520085346.GA99001@gmail.com","subject":"Re: [PATCH v4] mergetools: add winmerge as a builtin tool","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-20T20:03:36Z","receivedAt":"2015-05-20T20:03:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> On Wed, May 20, 2015 at 09:47:56AM +0200, Sebastian Schuberth wrote:\n>> On Wed, May 20, 2015 at 9:42 AM, David Aguilar <davvid@gmail.com> wrote:\n>> \n>> > +       OIFS=$IFS\n>> > +       IFS='\n>> > +'\n>> \n>> I guess this is just a formatting issue with the mail export as it should read\n>> \n>> IFS=$'\\n'\n>> \n>> Otherwise looks good to me.\n>> \n>> -- \n>> Sebastian Schuberth\n>\n> Thanks for the review.\n>\n> That's actually a literal newline inside a single-quoted string.\n>\n> I'm not sure how portable $'\\n' is, but the '<literal-newline>'\n> approach is used often in the git code.\n\nThanks for being observant ;-)  Unless it is contrib/completion that\nis known to be run with bash, please avoid $'string' and $\"string\".\n"}]}