git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-gui: fix error popup when doing blame -> "Show History Context"
@ 2020-03-02 18:35 Pratyush Yadav
  2020-03-03  0:10 ` Benjamin Poirier
  0 siblings, 1 reply; 2+ messages in thread
From: Pratyush Yadav @ 2020-03-02 18:35 UTC (permalink / raw)
  To: git; +Cc: Jonathan Gilbert, Benjamin Poirier

In d9c6469 (git-gui: update status bar to track operations, 2019-12-01)
the call to 'ui_status' in 'do_gitk' was updated to create the newly
introduced "status bar operation". This allowed this status text so show
along with other operations happening in parallel, and removed a race
between all these operations.

But in that refactor, the fact that 'ui_status' checks for the existence
of 'main_status' was overlooked. This leads to an error message popping
up when the user selects "Show History Context" from the blame window
context menu on a source line. The error occurs because when running
"blame" 'main_status' is not initialized.

So, add a check for the existence of 'main_status' in 'do_gitk'. This
fix reverts to the original behaviour. In the future, we might want to
look into a better way of telling 'do_gitk' which status bar to use.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
 git-gui.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index f41ed2e..d939844 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2205,11 +2205,13 @@ proc do_gitk {revs {is_submodule false}} {
 		set env(GIT_WORK_TREE) $_gitworktree
 		cd $pwd

-		set status_operation [$::main_status \
-			start \
-			[mc "Starting %s... please wait..." "gitk"]]
+		if {[info exists main_status]} {
+			set status_operation [$::main_status \
+				start \
+				[mc "Starting %s... please wait..." "gitk"]]

-		after 3500 [list $status_operation stop]
+			after 3500 [list $status_operation stop]
+		}
 	}
 }

--
2.21.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-gui: fix error popup when doing blame -> "Show History Context"
  2020-03-02 18:35 [PATCH] git-gui: fix error popup when doing blame -> "Show History Context" Pratyush Yadav
@ 2020-03-03  0:10 ` Benjamin Poirier
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Poirier @ 2020-03-03  0:10 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: git, Jonathan Gilbert

On 2020/03/03 00:05 +0530, Pratyush Yadav wrote:
> In d9c6469 (git-gui: update status bar to track operations, 2019-12-01)
> the call to 'ui_status' in 'do_gitk' was updated to create the newly
> introduced "status bar operation". This allowed this status text so show
> along with other operations happening in parallel, and removed a race
> between all these operations.
> 
> But in that refactor, the fact that 'ui_status' checks for the existence
> of 'main_status' was overlooked. This leads to an error message popping
> up when the user selects "Show History Context" from the blame window
> context menu on a source line. The error occurs because when running
> "blame" 'main_status' is not initialized.
> 
> So, add a check for the existence of 'main_status' in 'do_gitk'. This
> fix reverts to the original behaviour. In the future, we might want to
> look into a better way of telling 'do_gitk' which status bar to use.
> 
> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Tested-by: Benjamin Poirier <benjamin.poirier@gmail.com>

Thank you for looking into this.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-03  0:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 18:35 [PATCH] git-gui: fix error popup when doing blame -> "Show History Context" Pratyush Yadav
2020-03-03  0:10 ` Benjamin Poirier

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).