Skip to content

Commit 7dd7601

Browse files
committed
gitk: Tcl9.0 requires "tildeexpand" for tilde substitution
See also: https://www.tcl-lang.org/man/tcl9.0/TclCmd/filename.html Signed-off-by: YOKOTA Hiroshi <[email protected]>
1 parent 35c9518 commit 7dd7601

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

gitk

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12434,6 +12434,17 @@ proc get_path_encoding {path} {
1243412434
return $tcl_enc
1243512435
}
1243612436
12437+
# Tk9: Expand "~" and "~user_name" to canonical path name
12438+
# Tk8: Just pass original path name to use built-in tilde expander
12439+
proc tilde_expand {path} {
12440+
global have_tk90
12441+
if {$have_tk90} {
12442+
return [file tildeexpand $path]
12443+
} else {
12444+
return $path
12445+
}
12446+
}
12447+
1243712448
## For msgcat loading, first locate the installation location.
1243812449
if { [info exists ::env(GITK_MSGSDIR)] } {
1243912450
## Msgsdir was manually set in the environment.
@@ -12458,6 +12469,9 @@ if {[catch {package require Tk 8.4-} err]} {
1245812469
Gitk requires at least Tcl/Tk 8.4."]
1245912470
exit 1
1246012471
}
12472+
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12473+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
12474+
set have_tk90 [expr {[package vcompare $tk_version "9.0"] >= 0}]
1246112475
1246212476
# on OSX bring the current Wish process window to front
1246312477
if {[tk windowingsystem] eq "aqua"} {
@@ -12623,14 +12637,14 @@ catch {
1262312637
set config_file_tmp [file join $env(XDG_CONFIG_HOME) git gitk-tmp]
1262412638
} else {
1262512639
# default XDG_CONFIG_HOME
12626-
set config_file "~/.config/git/gitk"
12627-
set config_file_tmp "~/.config/git/gitk-tmp"
12640+
set config_file [tilde_expand "~/.config/git/gitk"]
12641+
set config_file_tmp [tilde_expand "~/.config/git/gitk-tmp"]
1262812642
}
1262912643
if {![file exists $config_file]} {
1263012644
# for backward compatibility use the old config file if it exists
12631-
if {[file exists "~/.gitk"]} {
12632-
set config_file "~/.gitk"
12633-
set config_file_tmp "~/.gitk-tmp"
12645+
if {[file exists [tilde_expand "~/.gitk"]]} {
12646+
set config_file [tilde_expand "~/.gitk"]
12647+
set config_file_tmp [tilde_expand "~/.gitk-tmp"]
1263412648
} elseif {![file exists [file dirname $config_file]]} {
1263512649
file mkdir [file dirname $config_file]
1263612650
}
@@ -12743,8 +12757,6 @@ set nullid "0000000000000000000000000000000000000000"
1274312757
set nullid2 "0000000000000000000000000000000000000001"
1274412758
set nullfile "/dev/null"
1274512759
12746-
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12747-
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1274812760
if {![info exists have_ttk]} {
1274912761
set have_ttk [llength [info commands ::ttk::style]]
1275012762
}

0 commit comments

Comments
 (0)