From fbd5ee81199f78b486a5e2f217ea0a74c908a5f9 Mon Sep 17 00:00:00 2001
From: Pat Thoyts <patthoyts@users.sourceforge.net>
Date: Tue, 15 Sep 2009 10:26:30 +0100
Subject: [PATCH] Work around leftover temporary save file.

If a file exists and is hidden on Windows the Tcl open command will
fail as the attributes provided in the CREAT call fail to match those
of the existing file. Forcing removal of the temporary file before we
begin solves any problems caused by previous failures to save the
application settings. An alternative would be to remove the hidden
attribute before calling 'open'.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 gitk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gitk b/gitk
index 1306178..a0214b7 100755
--- a/gitk
+++ b/gitk
@@ -2526,6 +2526,7 @@ proc savestuff {w} {
     if {$stuffsaved} return
     if {![winfo viewable .]} return
     catch {
+	if {[file exists ~/.gitk-new]} {file delete -force ~/.gitk-new}
 	set f [open "~/.gitk-new" w]
 	if {$::tcl_platform(platform) eq {windows}} {
 	    file attributes "~/.gitk-new" -hidden true
-- 
2.23.0