{"thread":{"id":"36912","subject":"[PATCH] gitk: honor TMPDIR when viewing external diffs","startedAt":"2014-06-13T21:13:37Z","lastAt":"2014-06-15T04:57:34Z","messageCount":2,"participants":["David Aguilar","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"244173","messageId":"1402694017-91249-1-git-send-email-davvid@gmail.com","threadId":"36912","inReplyTo":null,"subject":"[PATCH] gitk: honor TMPDIR when viewing external diffs","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-06-13T21:13:37Z","receivedAt":"2014-06-13T21:13:37Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"gitk fails to show diffs when browsing a read-only repository.\nThis is due to gitk's assumption that the current directory is always\nwritable.\n\nTeach gitk to honor either the GITK_TMPDIR or TMPDIR environment\nvariables.  This allows users to override the default location\nused when writing temporary files.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk | 11 +++++++++--\n 1 file changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 90764e8..82293dd 100755\n--- a/gitk\n+++ b/gitk\n@@ -3492,10 +3492,17 @@ 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 $gitdir [format \".gitk-tmp.%s\" [pid]]]\n+\tif {[info exists env(GITK_TMPDIR)]} {\n+\t    set tmpdir $env(GITK_TMPDIR)\n+\t} elseif {[info exists env(TMPDIR)]} {\n+\t    set tmpdir $env(TMPDIR)\n+\t} else {\n+\t    set tmpdir $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-- \n2.0.0.257.g75cc6c6\n"},{"id":"244201","messageId":"20140615045734.GE21978@iris.ozlabs.ibm.com","threadId":"36912","inReplyTo":"1402694017-91249-1-git-send-email-davvid@gmail.com","subject":"Re: [PATCH] gitk: honor TMPDIR when viewing external diffs","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2014-06-15T04:57:34Z","receivedAt":"2014-06-15T04:57:34Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Fri, Jun 13, 2014 at 02:13:37PM -0700, David Aguilar wrote:\n> gitk fails to show diffs when browsing a read-only repository.\n> This is due to gitk's assumption that the current directory is always\n> writable.\n> \n> Teach gitk to honor either the GITK_TMPDIR or TMPDIR environment\n> variables.  This allows users to override the default location\n> used when writing temporary files.\n> \n> Signed-off-by: David Aguilar <davvid@gmail.com>\n\nThanks, applied.\n\nPaul.\n"}]}