Subject: Re: [PATCH] git-gui: add mingw specific startup wrapper

From: "Shawn O. Pearce" <[email-masked]>
Date: Wed, 10 Oct 2007 02:22:18 -0400

Steffen Prohaska <[email-masked]> wrote:
> The wrapper adds the directory it is installed in to PATH.
> This is required for the git commands implemented in shell.
> git-gui fails to launch them if PATH is not modified.
> 
> The wrapper script also accepts an optional command line
> switch '--working-dir <dir>' and changes to <dir> before
> launching the actual git-gui. This is required to implement
> the "Git Gui Here" Explorer shell extension.
 
Nice.

> diff --git a/git-gui/Makefile b/git-gui/Makefile
> @@ -128,6 +128,7 @@ ifeq ($(uname_S),Darwin)
>  endif
>  ifneq (,$(findstring MINGW,$(uname_S)))
>  	NO_MSGFMT=1
> +	GITGUI_WINDOWS_WRAPPER := YesPlease
>  endif

I don't have this context in my Makefile so I can't apply this
additional line here.  Can someone package up the patch that
introduces the MINGW case above with a proper commit message,
so I can apply it in front of this patch?

>  install: all
> @@ -246,6 +257,9 @@ ifdef GITGUI_MACOSXAPP
>  	$(QUIET)$(INSTALL_A0)'Git Gui.app' $(INSTALL_A1) '$(DESTDIR_SQ)$(libdir_SQ)'
>  	$(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)'
>  endif
> +ifdef GITGUI_WINDOWS_WRAPPER
> +	$(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)'
> +endif
>  	$(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
>  	$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1)
>  	$(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true

I think you missed the entry in the uninstall and clean targets.

> diff --git a/git-gui/windows/git-gui.sh b/git-gui/windows/git-gui.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +# Tcl ignores the next line -*- tcl -*- \
> +exec wish "$0" -- "$@"
> +
> +if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
> +	cd [lindex $argv 1]
> +	set argv [lrange $argv 2 end]
> +	incr argc -2
> +}

Maybe we should just support this option directly in git-gui.
Today we also support doing something like this by setting the
GIT_DIR environment variable into a non-bare repository; see the
"# repository setup" block of git-gui.sh.

> +set gitguidir [file dirname [info script]]
> +regsub -all ";" $gitguidir "\\;" gitguidir
> +set env(PATH) "$gitguidir;$env(PATH)"
> +unset gitguidir
> +
> +source [file join [file dirname [info script]] git-gui.tcl]

Hmmph.  The install target was going into libdir but the above
source doesn't seem to read from there, its loading from the same
location as the git-gui wrapper script.  You msys guys probably
don't have $(libdir) == $(gitexecdir), do you?

-- 
Shawn.