git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: Add ability to define an alternate temporary directory
@ 2009-11-11  1:49 David Aguilar
  2009-11-11  1:49 ` [PATCH] gitk: Document the $GITK_TMPDIR variable David Aguilar
  2009-11-11  3:59 ` [PATCH] gitk: Add ability to define an alternate temporary directory Sam Vilain
  0 siblings, 2 replies; 9+ messages in thread
From: David Aguilar @ 2009-11-11  1:49 UTC (permalink / raw)
  To: paulus; +Cc: git, David Aguilar

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-11-12  9:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11  1:49 [PATCH] gitk: Add ability to define an alternate temporary directory David Aguilar
2009-11-11  1:49 ` [PATCH] gitk: Document the $GITK_TMPDIR variable David Aguilar
2009-11-11  3:59 ` [PATCH] gitk: Add ability to define an alternate temporary directory Sam Vilain
2009-11-11  4:07   ` David Aguilar
2009-11-11  4:42     ` Junio C Hamano
2009-11-11 16:44       ` David Aguilar
2009-11-12  8:35         ` Jeff King
2009-11-12  9:36           ` David Aguilar
2009-11-12  9:56             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).