]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: fix error popup when doing blame -> "Show History Context"
authorPratyush Yadav <me@yadavpratyush.com>
Mon, 2 Mar 2020 18:15:54 +0000 (23:45 +0530)
committerPratyush Yadav <me@yadavpratyush.com>
Mon, 2 Mar 2020 18:36:34 +0000 (00:06 +0530)
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 to 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

index f41ed2eb203a62928e8d34bf88a24ab8108e0f50..d939844942e1fbd7734d872979f350b9d8dae3fa 100755 (executable)
@@ -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]
+               }
        }
 }