]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: fix inability to quit after closing another instance
authorOrgad Shaneh <orgads@gmail.com>
Tue, 7 Feb 2023 07:43:17 +0000 (09:43 +0200)
committerOrgad Shaneh <orgads@gmail.com>
Sun, 30 Jun 2024 06:15:04 +0000 (09:15 +0300)
If you open 2 git gui instances in the same directory, then close one
of them and try to close the other, an error message pops up, saying:
'error renaming ".git/GITGUI_BCK": no such file or directory', and it
is no longer possible to close the window ever.

Fix by catching this error, and proceeding even if the file no longer
exists.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
git-gui.sh

index 507fb2b6826cf6ca264290f3a6eb907b8d525c11..8fe7538e72084d1d794c88e00402602be7df7d65 100755 (executable)
@@ -2301,7 +2301,7 @@ proc do_quit {{rc {1}}} {
                #
                set save [gitdir GITGUI_MSG]
                if {$GITGUI_BCK_exists && ![$ui_comm edit modified]} {
-                       file rename -force [gitdir GITGUI_BCK] $save
+                       catch { file rename -force [gitdir GITGUI_BCK] $save }
                        set GITGUI_BCK_exists 0
                } elseif {[$ui_comm edit modified]} {
                        set msg [string trim [$ui_comm get 0.0 end]]