git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitk: honor TMPDIR when viewing external diffs
@ 2014-06-13 21:13 David Aguilar
  2014-06-15  4:57 ` Paul Mackerras
  0 siblings, 1 reply; 2+ messages in thread
From: David Aguilar @ 2014-06-13 21:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

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: David Aguilar <davvid@gmail.com>
---
 gitk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gitk b/gitk
index 90764e8..82293dd 100755
--- a/gitk
+++ b/gitk
@@ -3492,10 +3492,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
-- 
2.0.0.257.g75cc6c6

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

* Re: [PATCH] gitk: honor TMPDIR when viewing external diffs
  2014-06-13 21:13 [PATCH] gitk: honor TMPDIR when viewing external diffs David Aguilar
@ 2014-06-15  4:57 ` Paul Mackerras
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mackerras @ 2014-06-15  4:57 UTC (permalink / raw)
  To: David Aguilar; +Cc: git

On Fri, Jun 13, 2014 at 02:13:37PM -0700, David Aguilar wrote:
> 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: David Aguilar <davvid@gmail.com>

Thanks, applied.

Paul.

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

end of thread, other threads:[~2014-06-15  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 21:13 [PATCH] gitk: honor TMPDIR when viewing external diffs David Aguilar
2014-06-15  4:57 ` Paul Mackerras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).