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
This commit is contained in:
@ -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'"
|
||||
|
||||
Reference in New Issue
Block a user