git-gui: fix inability to quit after closing another instance

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>
maint
Orgad Shaneh 2023-02-07 09:43:17 +02:00
parent c1db988093
commit f402c7941f
1 changed files with 1 additions and 1 deletions

View File

@ -2301,7 +2301,7 @@ proc do_quit {{rc {1}}} {
# #
set save [gitdir GITGUI_MSG] set save [gitdir GITGUI_MSG]
if {$GITGUI_BCK_exists && ![$ui_comm edit modified]} { 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 set GITGUI_BCK_exists 0
} elseif {[$ui_comm edit modified]} { } elseif {[$ui_comm edit modified]} {
set msg [string trim [$ui_comm get 0.0 end]] set msg [string trim [$ui_comm get 0.0 end]]