git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Orgad Shaneh via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 1, 2023, 08:26 UTC
Message-ID
<pull.1446.git.git.1675239967804.gitgitgadget@gmail.com>
From: Orgad Shaneh <orgads@gmail.com>

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: 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.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1446%2Forgads%2Fgit-gui-no-quit-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1446/orgads/git-gui-no-quit-v1
Pull-Request: https://github.com/git/git/pull/1446
 git-gui/git-gui.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 201524c34ed..b00ee691e3b 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -2307,7 +2307,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]]

base-commit: 2fc9e9ca3c7505bc60069f11e7ef09b1aeeee473
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 3 in “git-gui: fix inability to quit after closing another instance”
  1. git-gui: fix inability to quit after closing another instanceOrgad Shaneh via GitGitGadget, Feb 1, 2023
  2. Junio C HamanoFeb 1, 2023
  3. Orgad ShanehApr 20, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.