{"thread":{"id":"55875","subject":"[PATCH] mergetools/kdiff3: make kdiff3 work on windows too","startedAt":"2021-06-07T20:19:53Z","lastAt":"2021-06-08T01:26:16Z","messageCount":2,"participants":["Michael Schindler via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"426660","messageId":"pull.952.git.git.1623097114277.gitgitgadget@gmail.com","threadId":"55875","inReplyTo":null,"subject":"[PATCH] mergetools/kdiff3: make kdiff3 work on windows too","fromName":"Michael Schindler via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2021-06-07T20:18:33Z","receivedAt":"2021-06-07T20:19:53Z","isPatch":true,"sender":{"key":"name:Michael Schindler","avatar":null},"body":"From: Michael Schindler <michael@compressconsult.com>\n\nCurrently the native kdiff3 mergetool is not found by git mergetool on windows.\nThe message \"The merge tool kdiff3 is not available as 'kdiff3'\" is displayed.\n\nBut it is important especially for GUI to use this native version on windows.\nKdiff3 for various systems can be downloaded from https://download.kde.org/stable/kdiff3/\n\nBug cause:\nOn Windows the executable name has to be translated (kdiff3.exe instead of kdiff) and the windows path has to be searched - similar to winmerge.\n\nFix:\nThis change is using mergetool_find_win32_cmd from the library in the translate_merge_tool_path().\nThis is done the same way as in winmerge.\n\nHowever this translation must not be made on linux/unix, so a \"type kdiff3\" test is made on kdiff3 and only if not found the windows search is tried.\n\nSigned-off-by: Michael Schindler michael@compressconsult.com\n---\n    mergetools/kdiff3: make kdiff3 work on windows too\n    \n    mergetools/kdiff3: make kdiff3 work on windows too\n    \n    Currently the native kdiff3 mergetool is not found by git mergetool on\n    windows. The message \"The merge tool kdiff3 is not available as\n    'kdiff3'\" is displayed.\n    \n    But it is important especially for GUI to use this native version on\n    windows. Kdiff3 for various systems can be downloaded from\n    https://download.kde.org/stable/kdiff3/\n    \n    Bug cause: On Windows the executable name has to be translated\n    (kdiff3.exe instead of kdiff) and the windows path has to be searched -\n    similar to winmerge.\n    \n    Fix: This change is using mergetool_find_win32_cmd from the library in\n    the translate_merge_tool_path(). This is done the same way as in\n    winmerge.\n    \n    However this translation must not be made on linux/unix, so a \"type\n    kdiff3\" test is made on kdiff3 and only if not found the windows search\n    is tried.\n    \n    Signed-off-by: Michael Schindler michael@compressconsult.com\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-952%2Fmichaelcompressconsult%2Fkdiff3_win-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-952/michaelcompressconsult/kdiff3_win-v1\nPull-Request: https://github.com/git/git/pull/952\n\n mergetools/kdiff3 | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/mergetools/kdiff3 b/mergetools/kdiff3\nindex 0264ed5b20b2..520cb914a18b 100644\n--- a/mergetools/kdiff3\n+++ b/mergetools/kdiff3\n@@ -25,3 +25,12 @@ merge_cmd () {\n exit_code_trustable () {\n \ttrue\n }\n+\n+translate_merge_tool_path() {\n+\tif type kdiff3 >/dev/null 2>/dev/null\n+\tthen\n+\t\techo kdiff3\n+\telse\n+\t\tmergetool_find_win32_cmd \"kdiff3.exe\" \"Kdiff3\"\n+\tfi\n+}\n\nbase-commit: c09b6306c6ca275ed9d0348a8c8014b2ff723cfb\n-- \ngitgitgadget\n"},{"id":"426685","messageId":"xmqqbl8hrvte.fsf@gitster.g","threadId":"55875","inReplyTo":"pull.952.git.git.1623097114277.gitgitgadget@gmail.com","subject":"Re: [PATCH] mergetools/kdiff3: make kdiff3 work on windows too","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-06-08T01:26:05Z","receivedAt":"2021-06-08T01:26:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael Schindler via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Michael Schindler <michael@compressconsult.com>\n\nThanks.  The proposed log message is overly long and looks unusual\nto have \"Bug cause:\" and \"Fix:\" markers in it.  It would be nice if\nit fit well when found in say \"git log --no-merges\" output with\nother commits.\n\n> Currently the native kdiff3 mergetool is not found by git mergetool on windows.\n> The message \"The merge tool kdiff3 is not available as 'kdiff3'\" is displayed.\n\nVery well explained.  You can lose \"Currently\", though.  Also wrap\nthe line at around 70 columns and it would be perfect.\n\n> But it is important especially for GUI to use this native version on windows.\n> Kdiff3 for various systems can be downloaded from https://download.kde.org/stable/kdiff3/\n\nI am not sure how these two lines help.  We've established with the\nfirst two lines that the native kdiff3 is not found, even though\nkdiff3 is available on windows, so it is clear that we'd want to\nmake it available.  If I were writing this, I'd drop these two lines.\n\nSo, after the first two lines to describe what is wrong, we can just\nsay something like\n\n    Just like we translate the name of the binary and look for the\n    program on search path for winmerge, do the same for kdiff3.\n\nand all the remainder, up to but not including your sign-off, can be\nremoved, I think.\n\n> Bug cause:\n> On Windows the executable name has to be translated (kdiff3.exe instead of kdiff) and the windows path has to be searched - similar to winmerge.\n>\n> Fix:\n> This change is using mergetool_find_win32_cmd from the library in the translate_merge_tool_path().\n> This is done the same way as in winmerge.\n>\n> However this translation must not be made on linux/unix, so a \"type kdiff3\" test is made on kdiff3 and only if not found the windows search is tried.\n>\n> Signed-off-by: Michael Schindler michael@compressconsult.com\n> ---\n>     mergetools/kdiff3: make kdiff3 work on windows too\n>     \n>     mergetools/kdiff3: make kdiff3 work on windows too\n>     \n>     Currently the native kdiff3 mergetool is not found by git mergetool on\n>     windows. The message \"The merge tool kdiff3 is not available as\n>     'kdiff3'\" is displayed.\n>     \n>     But it is important especially for GUI to use this native version on\n>     windows. Kdiff3 for various systems can be downloaded from\n>     https://download.kde.org/stable/kdiff3/\n>     \n>     Bug cause: On Windows the executable name has to be translated\n>     (kdiff3.exe instead of kdiff) and the windows path has to be searched -\n>     similar to winmerge.\n>     \n>     Fix: This change is using mergetool_find_win32_cmd from the library in\n>     the translate_merge_tool_path(). This is done the same way as in\n>     winmerge.\n>     \n>     However this translation must not be made on linux/unix, so a \"type\n>     kdiff3\" test is made on kdiff3 and only if not found the windows search\n>     is tried.\n>     \n>     Signed-off-by: Michael Schindler michael@compressconsult.com\n\nThis is redundant---it says the same thing as your proposed commit\nlog message.\n\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-952%2Fmichaelcompressconsult%2Fkdiff3_win-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-952/michaelcompressconsult/kdiff3_win-v1\n> Pull-Request: https://github.com/git/git/pull/952\n>\n>  mergetools/kdiff3 | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n>\n> diff --git a/mergetools/kdiff3 b/mergetools/kdiff3\n> index 0264ed5b20b2..520cb914a18b 100644\n> --- a/mergetools/kdiff3\n> +++ b/mergetools/kdiff3\n> @@ -25,3 +25,12 @@ merge_cmd () {\n>  exit_code_trustable () {\n>  \ttrue\n>  }\n> +\n> +translate_merge_tool_path() {\n> +\tif type kdiff3 >/dev/null 2>/dev/null\n> +\tthen\n> +\t\techo kdiff3\n> +\telse\n> +\t\tmergetool_find_win32_cmd \"kdiff3.exe\" \"Kdiff3\"\n> +\tfi\n> +}\n\nThe change looks good.  Thanks.\n"}]}