All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Yadav <me@yadavpratyush.com>
To: Konstantin Podsvirov via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Konstantin Podsvirov <konstantin@podsvirov.pro>
Subject: Re: [PATCH] git-gui: msys2 compatibility patches
Date: Tue, 28 Apr 2020 01:15:46 +0530	[thread overview]
Message-ID: <20200427194546.7ce4z2ooe4jaab5w@yadavpratyush.com> (raw)
In-Reply-To: <pull.612.git.1586900734341.gitgitgadget@gmail.com>

Hi Konstantin,

Thanks for the patch, and sorry for the late reply.

On 14/04/20 09:45PM, Konstantin Podsvirov via GitGitGadget wrote:
> From: Konstantin Podsvirov <konstantin@podsvirov.pro>
> 
> Allow using `git gui` command via MSYS2's MINGW32/64 subsystems (apropriate shells).

I think this should be the commit subject, instead of "msys2 
compatibility patches".
 
> Just install apropriate `tk` package:
> 
> ```bash
> user@host MINGW32 ~
> pacman -S mingw-w64-i686-tk
> ```
> 
> or
> 
> ```bash
> user@host MINGW64 ~
> pacman -S mingw-w64-x86_64-tk
> ```
> 
> For more info see: https://github.com/msys2/MSYS2-packages/pull/1912

Please don't just link to an external website. Put the explanation there 
in the commit message. Explain what the problem was, and how this patch 
fixes it.
 
> Signed-off-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
> ---
>  git-gui.sh | 52 ++++++++++++++++++++++++++++++----------------------
>  1 file changed, 30 insertions(+), 22 deletions(-)
> 
> diff --git a/git-gui.sh b/git-gui.sh
> index 4610e4ca72a..512f4f121aa 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -44,6 +44,28 @@ if {[catch {package require Tcl 8.5} err]
>  
>  catch {rename send {}} ; # What an evil concept...
>  
> +######################################################################
> +##
> +## platform detection
> +
> +set _iscygwin {}
> +
> +proc is_Cygwin {} {
> +	global _iscygwin
> +	if {$_iscygwin eq {}} {
> +		if {$::tcl_platform(platform) eq {windows}} {
> +			if {[catch {set p [exec cygpath --windir]} err]} {
> +				set _iscygwin 0
> +			} else {
> +				set _iscygwin 1
> +			}
> +		} else {
> +			set _iscygwin 0
> +		}
> +	}
> +	return $_iscygwin
> +}
> +
>  ######################################################################
>  ##
>  ## locate our library
> @@ -51,7 +73,14 @@ catch {rename send {}} ; # What an evil concept...
>  if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
>  	set oguilib $::env(GIT_GUI_LIB_DIR)
>  } else {
> -	set oguilib {@@GITGUI_LIBDIR@@}
> +	if {[is_Cygwin]} {
> +		set oguilib [exec cygpath \
> +			--windows \
> +			--absolute \
> +			@@GITGUI_LIBDIR@@]
> +	} else {
> +		set oguilib {@@GITGUI_LIBDIR@@}
> +	}

This would convert the Windows style path to a Unix style path if we are 
running in Cygwin, right? This is what I assume the heart of the problem 
is.

Style nitpick: something like this would probably be better:

  set oguilib {@@GITGUI_LIBDIR@@}
  if {[is_Cygwin]} {
	...
  }

This makes it clear that Cygwin is the exception. For all other cases, 
we want to use @@GITGUI_LIBDIR@@ directly.

>  }
>  set oguirel {@@GITGUI_RELATIVE@@}
>  if {$oguirel eq {1}} {
> @@ -163,7 +192,6 @@ set _isbare {}
>  set _gitexec {}
>  set _githtmldir {}
>  set _reponame {}
> -set _iscygwin {}

Why move the initialization?

>  set _search_path {}
>  set _shellpath {@@SHELL_PATH@@}
>  
> @@ -266,26 +294,6 @@ proc is_Windows {} {
>  	return 0
>  }
>  
> -proc is_Cygwin {} {
> -	global _iscygwin
> -	if {$_iscygwin eq {}} {
> -		if {$::tcl_platform(platform) eq {windows}} {
> -			if {[catch {set p [exec cygpath --windir]} err]} {
> -				set _iscygwin 0
> -			} else {
> -				set _iscygwin 1
> -				# Handle MSys2 which is only cygwin when MSYSTEM is MSYS.
> -				if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} {
> -					set _iscygwin 0
> -				}

I'm afraid I don't understand this hunk. I don't use Windows, and don't 
completely understand the difference between cygwin, msys, etc. Could 
you please explain further why this check is removed? Are there any 
negative side-effects?

> -			}
> -		} else {
> -			set _iscygwin 0
> -		}
> -	}
> -	return $_iscygwin
> -}
> -

Why move the function? Can't this and the _iscygwin initialization just 
stay in their place? It will make the diff much easier to read.

>  proc is_enabled {option} {
>  	global enabled_options
>  	if {[catch {set on $enabled_options($option)}]} {return 0}

-- 
Regards,
Pratyush Yadav

  reply	other threads:[~2020-04-27 19:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 21:45 [PATCH] git-gui: msys2 compatibility patches Konstantin Podsvirov via GitGitGadget
2020-04-27 19:45 ` Pratyush Yadav [this message]
2020-04-27 21:33   ` Konstantin Podsvirov
2020-05-05 12:28     ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200427194546.7ce4z2ooe4jaab5w@yadavpratyush.com \
    --to=me@yadavpratyush.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=konstantin@podsvirov.pro \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.