Merge branch 'master' of https://github.com/j6t/gitk
* 'master' of https://github.com/j6t/gitk: gitk: add Tamil translation gitk: limit PATH search to bare executable names gitk: _search_exe is no longer needed gitk: override $PATH search only on Windows gitk: adjust indentation to match the style used in this script
This commit is contained in:
199
gitk-git/gitk
199
gitk-git/gitk
@@ -13,133 +13,102 @@ package require Tk
|
|||||||
##
|
##
|
||||||
## Enabling platform-specific code paths
|
## Enabling platform-specific code paths
|
||||||
|
|
||||||
proc is_MacOSX {} {
|
|
||||||
if {[tk windowingsystem] eq {aqua}} {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
proc is_Windows {} {
|
proc is_Windows {} {
|
||||||
if {$::tcl_platform(platform) eq {windows}} {
|
if {$::tcl_platform(platform) eq {windows}} {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
|
||||||
|
|
||||||
set _iscygwin {}
|
|
||||||
proc is_Cygwin {} {
|
|
||||||
global _iscygwin
|
|
||||||
if {$_iscygwin eq {}} {
|
|
||||||
if {[string match "CYGWIN_*" $::tcl_platform(os)]} {
|
|
||||||
set _iscygwin 1
|
|
||||||
} else {
|
|
||||||
set _iscygwin 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $_iscygwin
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
## PATH lookup
|
## PATH lookup
|
||||||
|
|
||||||
set _search_path {}
|
if {[is_Windows]} {
|
||||||
proc _which {what args} {
|
set _search_path {}
|
||||||
global env _search_exe _search_path
|
proc _which {what args} {
|
||||||
|
global env _search_path
|
||||||
|
|
||||||
if {$_search_path eq {}} {
|
if {$_search_path eq {}} {
|
||||||
if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
|
set gitguidir [file dirname [info script]]
|
||||||
set _search_path [split [exec cygpath \
|
regsub -all ";" $gitguidir "\\;" gitguidir
|
||||||
--windows \
|
set env(PATH) "$gitguidir;$env(PATH)"
|
||||||
--path \
|
set _search_path [split $env(PATH) {;}]
|
||||||
--absolute \
|
# Skip empty `PATH` elements
|
||||||
$env(PATH)] {;}]
|
set _search_path [lsearch -all -inline -not -exact \
|
||||||
set _search_exe .exe
|
$_search_path ""]
|
||||||
} elseif {[is_Windows]} {
|
}
|
||||||
set gitguidir [file dirname [info script]]
|
|
||||||
regsub -all ";" $gitguidir "\\;" gitguidir
|
|
||||||
set env(PATH) "$gitguidir;$env(PATH)"
|
|
||||||
set _search_path [split $env(PATH) {;}]
|
|
||||||
# Skip empty `PATH` elements
|
|
||||||
set _search_path [lsearch -all -inline -not -exact \
|
|
||||||
$_search_path ""]
|
|
||||||
set _search_exe .exe
|
|
||||||
} else {
|
|
||||||
set _search_path [split $env(PATH) :]
|
|
||||||
set _search_exe {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
|
if {[lsearch -exact $args -script] >= 0} {
|
||||||
set suffix {}
|
set suffix {}
|
||||||
} else {
|
} else {
|
||||||
set suffix $_search_exe
|
set suffix .exe
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach p $_search_path {
|
foreach p $_search_path {
|
||||||
set p [file join $p $what$suffix]
|
set p [file join $p $what$suffix]
|
||||||
if {[file exists $p]} {
|
if {[file exists $p]} {
|
||||||
return [file normalize $p]
|
return [file normalize $p]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc sanitize_command_line {command_line from_index} {
|
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"
|
||||||
}
|
}
|
||||||
lset command_line $i $fullpath
|
lset command_line $i $fullpath
|
||||||
}
|
}
|
||||||
|
|
||||||
# handle piped commands, e.g. `exec A | B`
|
# handle piped commands, e.g. `exec A | B`
|
||||||
for {incr i} {$i < [llength $command_line]} {incr i} {
|
for {incr i} {$i < [llength $command_line]} {incr i} {
|
||||||
if {[lindex $command_line $i] eq "|"} {
|
if {[lindex $command_line $i] eq "|"} {
|
||||||
incr i
|
incr i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $command_line
|
return $command_line
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override `exec` to avoid unsafe PATH lookup
|
# Override `exec` to avoid unsafe PATH lookup
|
||||||
|
|
||||||
rename exec real_exec
|
rename exec real_exec
|
||||||
|
|
||||||
proc exec {args} {
|
proc exec {args} {
|
||||||
# skip options
|
# skip options
|
||||||
for {set i 0} {$i < [llength $args]} {incr i} {
|
for {set i 0} {$i < [llength $args]} {incr i} {
|
||||||
set arg [lindex $args $i]
|
set arg [lindex $args $i]
|
||||||
if {$arg eq "--"} {
|
if {$arg eq "--"} {
|
||||||
incr i
|
incr i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if {[string range $arg 0 0] ne "-"} {
|
if {[string range $arg 0 0] ne "-"} {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set args [sanitize_command_line $args $i]
|
set args [sanitize_command_line $args $i]
|
||||||
uplevel 1 real_exec $args
|
uplevel 1 real_exec $args
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override `open` to avoid unsafe PATH lookup
|
# Override `open` to avoid unsafe PATH lookup
|
||||||
|
|
||||||
rename open real_open
|
rename open real_open
|
||||||
|
|
||||||
proc open {args} {
|
proc open {args} {
|
||||||
set arg0 [lindex $args 0]
|
set arg0 [lindex $args 0]
|
||||||
if {[string range $arg0 0 0] eq "|"} {
|
if {[string range $arg0 0 0] eq "|"} {
|
||||||
set command_line [string trim [string range $arg0 1 end]]
|
set command_line [string trim [string range $arg0 1 end]]
|
||||||
lset args 0 "| [sanitize_command_line $command_line 0]"
|
lset args 0 "| [sanitize_command_line $command_line 0]"
|
||||||
}
|
}
|
||||||
uplevel 1 real_open $args
|
uplevel 1 real_open $args
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# End of safe PATH lookup stuff
|
# End of safe PATH lookup stuff
|
||||||
@@ -491,11 +460,11 @@ proc parseviewrevs {view revs} {
|
|||||||
# Escapes a list of filter paths to be passed to git log via stdin. Note that
|
# Escapes a list of filter paths to be passed to git log via stdin. Note that
|
||||||
# paths must not be quoted.
|
# paths must not be quoted.
|
||||||
proc escape_filter_paths {paths} {
|
proc escape_filter_paths {paths} {
|
||||||
set escaped [list]
|
set escaped [list]
|
||||||
foreach path $paths {
|
foreach path $paths {
|
||||||
lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
|
lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
|
||||||
}
|
}
|
||||||
return $escaped
|
return $escaped
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start off a git log process and arrange to read its output
|
# Start off a git log process and arrange to read its output
|
||||||
@@ -4632,7 +4601,7 @@ proc addviewmenu {n} {
|
|||||||
.bar.view add radiobutton -label $viewname($n) \
|
.bar.view add radiobutton -label $viewname($n) \
|
||||||
-command [list showview $n] -variable selectedview -value $n
|
-command [list showview $n] -variable selectedview -value $n
|
||||||
#$viewhlmenu add radiobutton -label $viewname($n) \
|
#$viewhlmenu add radiobutton -label $viewname($n) \
|
||||||
# -command [list addvhighlight $n] -variable selectedhlview
|
# -command [list addvhighlight $n] -variable selectedhlview
|
||||||
}
|
}
|
||||||
|
|
||||||
proc showview {n} {
|
proc showview {n} {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import('i18n').gettext('gitk',
|
|||||||
'pt_pt',
|
'pt_pt',
|
||||||
'ru',
|
'ru',
|
||||||
'sv',
|
'sv',
|
||||||
|
'ta',
|
||||||
'vi',
|
'vi',
|
||||||
'zh_cn',
|
'zh_cn',
|
||||||
],
|
],
|
||||||
|
|||||||
1457
gitk-git/po/ta.po
Normal file
1457
gitk-git/po/ta.po
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user