Merge git-gui into ml/git-gui-exec-path-fix

* git-gui:
  git-gui - use git-hook, honor core.hooksPath
  git-gui - re-enable use of hook scripts
maint
Junio C Hamano 2023-09-18 10:52:30 -07:00
commit c22e9efe9c
1 changed files with 3 additions and 26 deletions

View File

@ -118,7 +118,7 @@ proc sanitize_command_line {command_line from_index} {
set i $from_index set i $from_index
while {$i < [llength $command_line]} { while {$i < [llength $command_line]} {
set cmd [lindex $command_line $i] set cmd [lindex $command_line $i]
if {[file pathtype $cmd] ne "absolute"} { if {[llength [file split $cmd]] < 2} {
set fullpath [_which $cmd] set fullpath [_which $cmd]
if {$fullpath eq ""} { if {$fullpath eq ""} {
throw {NOT-FOUND} "$cmd not found in PATH" throw {NOT-FOUND} "$cmd not found in PATH"
@ -661,31 +661,8 @@ proc git_write {args} {
} }


proc githook_read {hook_name args} { proc githook_read {hook_name args} {
set pchook [gitdir hooks $hook_name] set cmd [concat git hook run --ignore-missing $hook_name -- $args 2>@1]
lappend args 2>@1 return [_open_stdout_stderr $cmd]

# On Windows [file executable] might lie so we need to ask
# the shell if the hook is executable. Yes that's annoying.
#
if {[is_Windows]} {
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 kill_file_process {fd} { proc kill_file_process {fd} {