All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Orgad Shaneh via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Orgad Shaneh <orgads@gmail.com>, Orgad Shaneh <orgads@gmail.com>
Subject: [PATCH] git-gui: fix inability to quit after closing another instance
Date: Wed, 01 Feb 2023 08:26:07 +0000	[thread overview]
Message-ID: <pull.1446.git.git.1675239967804.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2023-02-01  8:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  8:26 Orgad Shaneh via GitGitGadget [this message]
2023-02-01 17:22 ` [PATCH] git-gui: fix inability to quit after closing another instance Junio C Hamano
2024-04-20 21:58   ` Orgad Shaneh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1446.git.git.1675239967804.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=orgads@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.