summaryrefslogtreecommitdiff
path: root/git-gui/git-gui.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-01-20 20:36:16 -0800
committerJunio C Hamano <gitster@pobox.com>2008-01-20 20:36:16 -0800
commit36a189c86e4a4ad75a75f598eedfe2defab3cbf3 (patch)
tree50fb45f3a88aa9ad61e7ba2e0b194681aecfde3e /git-gui/git-gui.sh
parentce33288ea6b81a2f4f5aecd72177bcc8174562ae (diff)
parent6caaf2daf0ea50ff99009b94f24252b8fa747e64 (diff)
downloadgit-36a189c86e4a4ad75a75f598eedfe2defab3cbf3.tar.gz
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: Correct encoding of glossary/fr.po to UTF-8 git-gui: Consolidate hook execution code into a single function git-gui: Correct window title for hook failure dialogs git-gui: Honor the standard commit-msg hook
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-xgit-gui/git-gui.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index fcb2ab2fb7..f42e461fd4 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -438,6 +438,34 @@ proc git_write {args} {
return [open [concat $opt $cmdp $args] w]
}
+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
+ # the shell if the hook is executable. Yes that's annoying.
+ #
+ if {[is_Cygwin]} {
+ upvar #0 _sh interp
+ if {![info exists interp]} {
+ set interp [_which sh]
+ }
+ if {$interp eq {}} {
+ error "hook execution requires sh (not in PATH)"
+ }
+
+ set scr {if test -x "$1";then exec "$@";fi}
+ set sh_c [list | $interp -c $scr $interp $pchook]
+ return [_open_stdout_stderr [concat $sh_c $args]]
+ }
+
+ if {[file executable $pchook]} {
+ return [_open_stdout_stderr [concat [list | $pchook] $args]]
+ }
+
+ return {}
+}
+
proc sq {value} {
regsub -all ' $value "'\\''" value
return "'$value'"