提交 c7664f1a 编写于 作者: D David Aguilar 提交者: Paul Mackerras

gitk: Honor TMPDIR when viewing external diffs

gitk fails to show diffs when browsing a read-only repository.
This is due to gitk's assumption that the current directory is always
writable.

Teach gitk to honor either the GITK_TMPDIR or TMPDIR environment
variables.  This allows users to override the default location
used when writing temporary files.
Signed-off-by: NDavid Aguilar <davvid@gmail.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 17f9836c
......@@ -3493,10 +3493,17 @@ proc flist_hl {only} {
}
proc gitknewtmpdir {} {
global diffnum gitktmpdir gitdir
global diffnum gitktmpdir gitdir env
if {![info exists gitktmpdir]} {
set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
if {[info exists env(GITK_TMPDIR)]} {
set tmpdir $env(GITK_TMPDIR)
} elseif {[info exists env(TMPDIR)]} {
set tmpdir $env(TMPDIR)
} else {
set tmpdir $gitdir
}
set gitktmpdir [file join $tmpdir [format ".gitk-tmp.%s" [pid]]]
if {[catch {file mkdir $gitktmpdir} err]} {
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
unset gitktmpdir
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册