{"thread":{"id":"13916","subject":"[PATCH] Added mergetool.kdiff3.doubledash config option","startedAt":"2008-06-12T19:55:05Z","lastAt":"2008-06-14T06:29:04Z","messageCount":6,"participants":["Patrick Higgins","Junio C Hamano","patrick.higgins@cexp.com","Theodore Tso"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"79625","messageId":"1213300505-3867-1-git-send-email-patrick.higgins@cexp.com","threadId":"13916","inReplyTo":null,"subject":"[PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"Patrick Higgins","fromEmail":"patrick.higgins@cexp.com","sentAt":"2008-06-12T19:55:05Z","receivedAt":"2008-06-12T19:55:05Z","isPatch":true,"sender":{"key":"patrick.higgins@cexp.com","avatar":null},"body":"Qt-only builds of kdiff3 (no KDE) do not support a bare '--' on the command\nline. It will fail silently and mysteriously.\n\nSigned-off-by: Patrick Higgins <patrick.higgins@cexp.com>\n---\n Documentation/config.txt |    6 ++++++\n git-mergetool.sh         |   11 +++++++++--\n 2 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 5331b45..da40c2e 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -884,6 +884,12 @@ mergetool.<tool>.trustExitCode::\n \tif the file has been updated, otherwise the user is prompted to\n \tindicate the success of the merge.\n \n+mergetool.kdiff3.doubledash::\n+\tA boolean to indicate whether or not your kdiff3 supports a '--'\n+\ton the command line to separate options from filenames. If you\n+\tbuilt it without KDE, it probably doesn't have this support and\n+\tyou\tshould set this to false.  Defaults to true.\n+\n mergetool.keepBackup::\n \tAfter performing a merge, the original file with conflict markers\n \tcan be saved as a file with a `.orig` extension.  If this variable\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex fcdec4a..57cbac0 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -181,12 +181,19 @@ merge_file () {\n \n     case \"$merge_tool\" in\n \tkdiff3)\n+\t    doubledash=`git config --bool mergetool.kdiff3.doubledash`\n+\t    if test \"$doubledash\" = \"false\"; then\n+\t\tdouble_dash=\"\"\n+\t    else\n+\t\tdouble_dash=\"--\"\n+\t    fi\n+\n \t    if base_present ; then\n \t\t(\"$merge_tool_path\" --auto --L1 \"$MERGED (Base)\" --L2 \"$MERGED (Local)\" --L3 \"$MERGED (Remote)\" \\\n-\t\t    -o \"$MERGED\" -- \"$BASE\" \"$LOCAL\" \"$REMOTE\" > /dev/null 2>&1)\n+\t\t    -o \"$MERGED\" $double_dash \"$BASE\" \"$LOCAL\" \"$REMOTE\" > /dev/null 2>&1)\n \t    else\n \t\t(\"$merge_tool_path\" --auto --L1 \"$MERGED (Local)\" --L2 \"$MERGED (Remote)\" \\\n-\t\t    -o \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\" > /dev/null 2>&1)\n+\t\t    -o \"$MERGED\" $double_dash \"$LOCAL\" \"$REMOTE\" > /dev/null 2>&1)\n \t    fi\n \t    status=$?\n \t    ;;\n-- \n1.5.6.rc2\n"},{"id":"79630","messageId":"7vve0ez8z3.fsf@gitster.siamese.dyndns.org","threadId":"13916","inReplyTo":"1213300505-3867-1-git-send-email-patrick.higgins@cexp.com","subject":"Re: [PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-12T20:36:32Z","receivedAt":"2008-06-12T20:36:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Higgins <patrick.higgins@cexp.com> writes:\n\n> Qt-only builds of kdiff3 (no KDE) do not support a bare '--' on the command\n> line. It will fail silently and mysteriously.\n>\n> Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>\n\nHmm, I am seeing this patch for the first time, I have not seen any\ndiscussion history leading to the patch, and I have not been primarily\ninvolved in mergetool.  I'll Cc Ted to see what he thinks...\n\n> +mergetool.kdiff3.doubledash::\n> +\tA boolean to indicate whether or not your kdiff3 supports a '--'\n> +\ton the command line to separate options from filenames. If you\n> +\tbuilt it without KDE, it probably doesn't have this support and\n> +\tyou\tshould set this to false.  Defaults to true.\n\nThe above description makes it clear that there is an issue that needs to\nbe addressed.  I however am wondering if this can be either autodetected\nat runtime, or if it can't, the user should be able to specify the option\nwhen the user runs mergetool from the command line.  It would be necessary\nto countermand whichever choice you configured in your config when you\nneed to run kdiff3 with KDE from one machine and the one without from\nanother machine, wouldn't it?\n"},{"id":"79650","messageId":"911589C97062424796D53B625CEC0025E46159@USCOBRMFA-SE-70.northamerica.cexp.com","threadId":"13916","inReplyTo":"7vve0ez8z3.fsf@gitster.siamese.dyndns.org","subject":"RE: [PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"","fromEmail":"patrick.higgins@cexp.com","sentAt":"2008-06-12T22:44:03Z","receivedAt":"2008-06-12T22:44:03Z","isPatch":true,"sender":{"key":"patrick.higgins@cexp.com","avatar":null},"body":"From: Junio C Hamano [mailto:gitster@pobox.com]\n\n> Patrick Higgins <patrick.higgins@cexp.com> writes:\n> \n> > +mergetool.kdiff3.doubledash::\n> > +\tA boolean to indicate whether or not your kdiff3 supports a '--'\n> > +\ton the command line to separate options from filenames. If you\n> > +\tbuilt it without KDE, it probably doesn't have this support and\n> > +\tyou\tshould set this to false.  Defaults to true.\n> \n> The above description makes it clear that there is an issue \n> that needs to\n> be addressed.  I however am wondering if this can be either \n> autodetected\n> at runtime, or if it can't, the user should be able to \n> specify the option\n> when the user runs mergetool from the command line.  It would \n> be necessary\n> to countermand whichever choice you configured in your config when you\n> need to run kdiff3 with KDE from one machine and the one without from\n> another machine, wouldn't it?\n\nI have found the following to be a way to distinguish the two versions based solely on exit status. The broken one exits with 255.\n\nkdiff3 --auto -o /dev/null -- /dev/null /dev/null\n\nI'll work up another patch that uses this. This check adds about 0.5s overhead. That seems a little high to me, but given that mergetool is interactive, I guess that could be acceptable.\n"},{"id":"79730","messageId":"20080613145803.GE24675@mit.edu","threadId":"13916","inReplyTo":"911589C97062424796D53B625CEC0025E46159@USCOBRMFA-SE-70.northamerica.cexp.com","subject":"Re: [PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2008-06-13T14:58:03Z","receivedAt":"2008-06-13T14:58:03Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Thu, Jun 12, 2008 at 04:44:03PM -0600, Patrick.Higgins@cexp.com wrote:\n> I have found the following to be a way to distinguish the two\n> versions based solely on exit status. The broken one exits with 255.\n> \n> kdiff3 --auto -o /dev/null -- /dev/null /dev/null\n> \n> I'll work up another patch that uses this. This check adds about\n> 0.5s overhead. That seems a little high to me, but given that\n> mergetool is interactive, I guess that could be acceptable.\n\nHmm, do we have a policy about whether or not it is acceptable to\nmodify .gitconfig behind the user's back?  It would be nice if the\ncheck would be done once and then the result gets cached.  So if not\nin .gitconfig, maybe somewhere else.\n\n      \t       \t    \t     \t      - Ted\n"},{"id":"79803","messageId":"7vhcbwilps.fsf@gitster.siamese.dyndns.org","threadId":"13916","inReplyTo":"20080613145803.GE24675@mit.edu","subject":"Re: [PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-14T06:17:51Z","receivedAt":"2008-06-14T06:17:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Theodore Tso <tytso@mit.edu> writes:\n\n> On Thu, Jun 12, 2008 at 04:44:03PM -0600, Patrick.Higgins@cexp.com wrote:\n>> I have found the following to be a way to distinguish the two\n>> versions based solely on exit status. The broken one exits with 255.\n>> \n>> kdiff3 --auto -o /dev/null -- /dev/null /dev/null\n>> \n>> I'll work up another patch that uses this. This check adds about\n>> 0.5s overhead. That seems a little high to me, but given that\n>> mergetool is interactive, I guess that could be acceptable.\n>\n> Hmm, do we have a policy about whether or not it is acceptable to\n> modify .gitconfig behind the user's back?  It would be nice if the\n> check would be done once and then the result gets cached.  So if not\n> in .gitconfig, maybe somewhere else.\n\nThe reason I suggested either a cheap runtime check or command line\noverride was because you can be accessing the same repository from two\ndifferent machines, with different kdiff3.  If you check once and store\nthe result in .gitconfig or .git/config, it would not help the situation a\nbit, would it?\n"},{"id":"79805","messageId":"20080614062904.GB12260@mit.edu","threadId":"13916","inReplyTo":"7vhcbwilps.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Added mergetool.kdiff3.doubledash config option","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2008-06-14T06:29:04Z","receivedAt":"2008-06-14T06:29:04Z","isPatch":true,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Fri, Jun 13, 2008 at 11:17:51PM -0700, Junio C Hamano wrote:\n> The reason I suggested either a cheap runtime check or command line\n> override was because you can be accessing the same repository from two\n> different machines, with different kdiff3.  If you check once and store\n> the result in .gitconfig or .git/config, it would not help the situation a\n> bit, would it?\n\nGood point.  I'm not sure 0.5s is really fast enough to be considered\na \"cheap runtime check\", unfortunately.  At the very least it should\nbe cached across a single \"git mergetool\" invocation, though; maybe if\nthat were the case it would be acceptable.\n\n          \t\t\t\t\t- Ted\n"}]}