{"thread":{"id":"21588","subject":"[PATCH] gitk: Honor TMPDIR when viewing diffs externally","startedAt":"2009-11-12T09:37:49Z","lastAt":"2009-11-12T09:37:49Z","messageCount":1,"participants":["David Aguilar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"127429","messageId":"1258018669-47405-1-git-send-email-davvid@gmail.com","threadId":"21588","inReplyTo":null,"subject":"[PATCH] gitk: Honor TMPDIR when viewing diffs externally","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2009-11-12T09:37:49Z","receivedAt":"2009-11-12T09:37:49Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"gitk's external diff fails when browsing read-only repositories.\nThis is due to gitk's assumption that the current directory is\nalways writable.  By honoring TMPDIR we avoid this problem and\nallow users to define the location used for temporary files.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk |   10 +++++++---\n 1 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex db5ec54..a065e94 100755\n--- a/gitk\n+++ b/gitk\n@@ -3170,11 +3170,15 @@ proc flist_hl {only} {\n }\n \n proc gitknewtmpdir {} {\n-    global diffnum gitktmpdir gitdir\n+    global diffnum gitktmpdir gitdir env\n \n     if {![info exists gitktmpdir]} {\n-\tset gitktmpdir [file join [file dirname $gitdir] \\\n-\t\t\t    [format \".gitk-tmp.%s\" [pid]]]\n+\tif {[info exists env(TMPDIR)]} {\n+\t    set tmpdir $env(TMPDIR)\n+\t} else {\n+\t    set tmpdir [file dirname $gitdir]\n+\t}\n+\tset gitktmpdir [file join $tmpdir [format \".gitk-tmp.%s\" [pid]]]\n \tif {[catch {file mkdir $gitktmpdir} err]} {\n \t    error_popup \"[mc \"Error creating temporary directory %s:\" $gitktmpdir] $err\"\n \t    unset gitktmpdir\n-- \n1.6.5.2.180.gc5b3e\n"}]}