Skip to contentSkip to conversation

git-gui: Fix pre-commit hooks under MinGW/MSYS

PATCH New Alexander N. Gavrilov 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Fix pre-commit hooks under MinGW/MSYS

From: Alexander Gavrilov <[email protected]>

Apply the work-around for checking the executable permission of hook files not only on Cygwin, but on Windows in general.

---
This is a fix for msysgit issue #118.
(http://code.google.com/p/msysgit/issues/detail?id=118)

It may be possible to fix this in a better way, e.g. perhaps assume that if the hook exists on Windows, then it's executable (msysgit uses renaming to disable hooks), or at least check existance before running the shell, but I don't know enough Tcl to do it.

-- Alexander

 git-gui.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
git-gui.sh +2 -2
index e6e8890..2d14bf2 100755
@@ -473,10 +473,10 @@ proc githook_read {hook_name args} {
 	set pchook [gitdir hooks $hook_name]
 	lappend args 2>@1
 
-	# On Cygwin [file executable] might lie so we need to ask
+	# On Windows [file executable] might lie so we need to ask
 	# the shell if the hook is executable.  Yes that's annoying.
 	#
-	if {[is_Cygwin]} {
+	if {[is_Windows]} {
 		upvar #0 _sh interp
 		if {![info exists interp]} {
 			set interp [_which sh]
Signature · 1 line
1.5.3.3