All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mergetools/kdiff3: make kdiff3 work on windows too
@ 2021-06-07 20:18 Michael Schindler via GitGitGadget
  2021-06-08  1:26 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Schindler via GitGitGadget @ 2021-06-07 20:18 UTC (permalink / raw)
  To: git; +Cc: Michael Schindler, Michael Schindler

From: Michael Schindler <michael@compressconsult.com>

Currently the native kdiff3 mergetool is not found by git mergetool on windows.
The message "The merge tool kdiff3 is not available as 'kdiff3'" is displayed.

But it is important especially for GUI to use this native version on windows.
Kdiff3 for various systems can be downloaded from https://download.kde.org/stable/kdiff3/

Bug cause:
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.

Fix:
This change is using mergetool_find_win32_cmd from the library in the translate_merge_tool_path().
This is done the same way as in winmerge.

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.

Signed-off-by: Michael Schindler michael@compressconsult.com
---
    mergetools/kdiff3: make kdiff3 work on windows too
    
    mergetools/kdiff3: make kdiff3 work on windows too
    
    Currently the native kdiff3 mergetool is not found by git mergetool on
    windows. The message "The merge tool kdiff3 is not available as
    'kdiff3'" is displayed.
    
    But it is important especially for GUI to use this native version on
    windows. Kdiff3 for various systems can be downloaded from
    https://download.kde.org/stable/kdiff3/
    
    Bug cause: 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.
    
    Fix: This change is using mergetool_find_win32_cmd from the library in
    the translate_merge_tool_path(). This is done the same way as in
    winmerge.
    
    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.
    
    Signed-off-by: Michael Schindler michael@compressconsult.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-952%2Fmichaelcompressconsult%2Fkdiff3_win-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-952/michaelcompressconsult/kdiff3_win-v1
Pull-Request: https://github.com/git/git/pull/952

 mergetools/kdiff3 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
index 0264ed5b20b2..520cb914a18b 100644
--- a/mergetools/kdiff3
+++ b/mergetools/kdiff3
@@ -25,3 +25,12 @@ merge_cmd () {
 exit_code_trustable () {
 	true
 }
+
+translate_merge_tool_path() {
+	if type kdiff3 >/dev/null 2>/dev/null
+	then
+		echo kdiff3
+	else
+		mergetool_find_win32_cmd "kdiff3.exe" "Kdiff3"
+	fi
+}

base-commit: c09b6306c6ca275ed9d0348a8c8014b2ff723cfb
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mergetools/kdiff3: make kdiff3 work on windows too
  2021-06-07 20:18 [PATCH] mergetools/kdiff3: make kdiff3 work on windows too Michael Schindler via GitGitGadget
@ 2021-06-08  1:26 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2021-06-08  1:26 UTC (permalink / raw)
  To: Michael Schindler via GitGitGadget; +Cc: git, Michael Schindler

"Michael Schindler via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Michael Schindler <michael@compressconsult.com>

Thanks.  The proposed log message is overly long and looks unusual
to have "Bug cause:" and "Fix:" markers in it.  It would be nice if
it fit well when found in say "git log --no-merges" output with
other commits.

> Currently the native kdiff3 mergetool is not found by git mergetool on windows.
> The message "The merge tool kdiff3 is not available as 'kdiff3'" is displayed.

Very well explained.  You can lose "Currently", though.  Also wrap
the line at around 70 columns and it would be perfect.

> But it is important especially for GUI to use this native version on windows.
> Kdiff3 for various systems can be downloaded from https://download.kde.org/stable/kdiff3/

I am not sure how these two lines help.  We've established with the
first two lines that the native kdiff3 is not found, even though
kdiff3 is available on windows, so it is clear that we'd want to
make it available.  If I were writing this, I'd drop these two lines.

So, after the first two lines to describe what is wrong, we can just
say something like

    Just like we translate the name of the binary and look for the
    program on search path for winmerge, do the same for kdiff3.

and all the remainder, up to but not including your sign-off, can be
removed, I think.

> Bug cause:
> 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.
>
> Fix:
> This change is using mergetool_find_win32_cmd from the library in the translate_merge_tool_path().
> This is done the same way as in winmerge.
>
> 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.
>
> Signed-off-by: Michael Schindler michael@compressconsult.com
> ---
>     mergetools/kdiff3: make kdiff3 work on windows too
>     
>     mergetools/kdiff3: make kdiff3 work on windows too
>     
>     Currently the native kdiff3 mergetool is not found by git mergetool on
>     windows. The message "The merge tool kdiff3 is not available as
>     'kdiff3'" is displayed.
>     
>     But it is important especially for GUI to use this native version on
>     windows. Kdiff3 for various systems can be downloaded from
>     https://download.kde.org/stable/kdiff3/
>     
>     Bug cause: 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.
>     
>     Fix: This change is using mergetool_find_win32_cmd from the library in
>     the translate_merge_tool_path(). This is done the same way as in
>     winmerge.
>     
>     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.
>     
>     Signed-off-by: Michael Schindler michael@compressconsult.com

This is redundant---it says the same thing as your proposed commit
log message.

> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-952%2Fmichaelcompressconsult%2Fkdiff3_win-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-952/michaelcompressconsult/kdiff3_win-v1
> Pull-Request: https://github.com/git/git/pull/952
>
>  mergetools/kdiff3 | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
> index 0264ed5b20b2..520cb914a18b 100644
> --- a/mergetools/kdiff3
> +++ b/mergetools/kdiff3
> @@ -25,3 +25,12 @@ merge_cmd () {
>  exit_code_trustable () {
>  	true
>  }
> +
> +translate_merge_tool_path() {
> +	if type kdiff3 >/dev/null 2>/dev/null
> +	then
> +		echo kdiff3
> +	else
> +		mergetool_find_win32_cmd "kdiff3.exe" "Kdiff3"
> +	fi
> +}

The change looks good.  Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-08  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 20:18 [PATCH] mergetools/kdiff3: make kdiff3 work on windows too Michael Schindler via GitGitGadget
2021-06-08  1:26 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.