{"thread":{"id":"13921","subject":"[PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported","startedAt":"2008-06-12T23:03:37Z","lastAt":"2008-06-13T05:36:35Z","messageCount":2,"participants":["Patrick Higgins","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"79651","messageId":"1213311817-4673-1-git-send-email-patrick.higgins@cexp.com","threadId":"13921","inReplyTo":null,"subject":"[PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported","fromName":"Patrick Higgins","fromEmail":"patrick.higgins@cexp.com","sentAt":"2008-06-12T23:03:37Z","receivedAt":"2008-06-12T23:03:37Z","isPatch":true,"sender":{"key":"patrick.higgins@cexp.com","avatar":null},"body":"kdiff3 can be compiled with Qt only or with KDE support. If compiled with\nQt only, it does not support '--' and mergetool fails silently.\n\nSigned-off-by: Patrick Higgins <patrick.higgins@cexp.com>\n---\n git-mergetool.sh |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex fcdec4a..85ce004 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    \"$merge_tool_path\" --auto -o /dev/null -- /dev/null /dev/null\n+\t    if test $? -ne 0; 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":"79674","messageId":"7vlk19yjz0.fsf@gitster.siamese.dyndns.org","threadId":"13921","inReplyTo":"1213311817-4673-1-git-send-email-patrick.higgins@cexp.com","subject":"Re: [PATCH v2] Detect if kdiff3 supports '--' and do not supply it if not supported","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-13T05:36:35Z","receivedAt":"2008-06-13T05:36:35Z","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> kdiff3 can be compiled with Qt only or with KDE support. If compiled with\n> Qt only, it does not support '--' and mergetool fails silently.\n>\n> Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>\n> ---\n>  git-mergetool.sh |   11 +++++++++--\n>  1 files changed, 9 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-mergetool.sh b/git-mergetool.sh\n> index fcdec4a..85ce004 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    \"$merge_tool_path\" --auto -o /dev/null -- /dev/null /dev/null\n> +\t    if test $? -ne 0; 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\nNow, when the name of the merged file begins with a dash (or dash-dash),\nwhat does kdiff3 without KDE do?\n\nI am wondering if it would be simpler and more robust if we did something\nlike this, which would let us get rid of double-dash from many places...\n\n git-mergetool.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex fcdec4a..3d9833e 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -141,10 +141,10 @@ merge_file () {\n     fi\n \n     ext=\"$$$(expr \"$MERGED\" : '.*\\(\\.[^/]*\\)$')\"\n-    BACKUP=\"$MERGED.BACKUP.$ext\"\n-    LOCAL=\"$MERGED.LOCAL.$ext\"\n-    REMOTE=\"$MERGED.REMOTE.$ext\"\n-    BASE=\"$MERGED.BASE.$ext\"\n+    BACKUP=\"./$MERGED.BACKUP.$ext\"\n+    LOCAL=\"./$MERGED.LOCAL.$ext\"\n+    REMOTE=\"./$MERGED.REMOTE.$ext\"\n+    BASE=\"./$MERGED.BASE.$ext\"\n \n     mv -- \"$MERGED\" \"$BACKUP\"\n     cp -- \"$BACKUP\" \"$MERGED\"\n"}]}