]> git.ipfire.org Git - thirdparty/git.git/commit
gitk: Tcl9 doesn't expand ~, use $env(HOME)
authorMark Levedahl <mlevedahl@gmail.com>
Mon, 24 Mar 2025 12:45:32 +0000 (08:45 -0400)
committerMark Levedahl <mlevedahl@gmail.com>
Thu, 17 Jul 2025 03:02:38 +0000 (23:02 -0400)
commitbcf94fe072615b5ca2ecae683fb2bc58876cabdf
tree4c840024d016575c3ee3431fd96c31766526a4f4
parentab30c04e9c7a5dd61767646a345ba364f70f6977
gitk: Tcl9 doesn't expand ~, use $env(HOME)

gitk looks for configuration files under $(HOME)/.., and uses the
typical shortcut formats to find this, e.g., ~/.config/. This relies
upon Tcl expanding such constructs to replace ~ with $(HOME). But, Tcl 9
has stopped doing that for various reasons, and now supplies [file
tildeexpand ...] to perform this expansion.

There are a very few places that need this expansion, and all must be
modified regardless of approach taken.

POSIX specifies that $HOME be defined at the time of login, and both
Cygwin and MSYS (underlying git for windows) set this variable. Tcl8
uses the POSIX defined pwnam to look up the underlying database record
on Unix, but will get the same result as using $HOME on any POSIX
compliant system. On Windows, Tcl just accesses $HOME, falling back to
other environment variables if $HOME is not set.  Git for Windows has
$HOME defined by MSYS, so this works just as on the others.

As $env(HOME) works in Tcl 8 and 9, while anything using [file
tildeexpand ... ] will not, let's use the simpler approach as doing so
adds no lines of code.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
gitk