git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: Add ability to define an alternate temporary directory

From
David Aguilar <davvid@gmail.com>
Date
Nov 11, 2009, 01:49 UTC
Message-ID
<1257904149-44381-1-git-send-email-davvid@gmail.com>

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

This teaches gitk to honor the GITK_TMPDIR environment variable. This allows users to override the default location used for writing temporary files.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 gitk |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gitk b/gitk
index db5ec54..9139ace 100755
--- a/gitk
+++ b/gitk
@@ -3170,11 +3170,15 @@ proc flist_hl {only} {
 }
 
 proc gitknewtmpdir {} {
-    global diffnum gitktmpdir gitdir
+    global diffnum env gitktmpdir gitdir
 
     if {![info exists gitktmpdir]} {
-	set gitktmpdir [file join [file dirname $gitdir] \
-			    [format ".gitk-tmp.%s" [pid]]]
+	if {[info exists env(GITK_TMPDIR)]} {
+	    set tmpdir $env(GITK_TMPDIR)
+	} else {
+	    set tmpdir [file dirname $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
-- 
1.6.5.2.180.gc5b3e
Next: David Aguilar
Message 1 of 9 in “gitk: Add ability to define an alternate temporary directory”
  1. gitk: Add ability to define an alternate temporary directoryDavid Aguilar, Nov 11, 2009
  2. gitk: Document the $GITK_TMPDIR variableDavid Aguilar, Nov 11, 2009
  3. Sam VilainNov 11, 2009
  4. David AguilarNov 11, 2009
  5. Junio C HamanoNov 11, 2009
  6. David AguilarNov 11, 2009
  7. Jeff KingNov 12, 2009
  8. David AguilarNov 12, 2009
  9. Jeff KingNov 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.