{"thread":{"id":"52927","subject":"[PATCH] git-gui: fix error popup when doing blame -> \"Show History Context\"","startedAt":"2020-03-02T18:35:54Z","lastAt":"2020-03-03T00:10:45Z","messageCount":2,"participants":["Pratyush Yadav","Benjamin Poirier"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"392748","messageId":"20200302183538.7195-1-me@yadavpratyush.com","threadId":"52927","inReplyTo":null,"subject":"[PATCH] git-gui: fix error popup when doing blame -> \"Show History Context\"","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2020-03-02T18:35:38Z","receivedAt":"2020-03-02T18:35:54Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"In d9c6469 (git-gui: update status bar to track operations, 2019-12-01)\nthe call to 'ui_status' in 'do_gitk' was updated to create the newly\nintroduced \"status bar operation\". This allowed this status text so show\nalong with other operations happening in parallel, and removed a race\nbetween all these operations.\n\nBut in that refactor, the fact that 'ui_status' checks for the existence\nof 'main_status' was overlooked. This leads to an error message popping\nup when the user selects \"Show History Context\" from the blame window\ncontext menu on a source line. The error occurs because when running\n\"blame\" 'main_status' is not initialized.\n\nSo, add a check for the existence of 'main_status' in 'do_gitk'. This\nfix reverts to the original behaviour. In the future, we might want to\nlook into a better way of telling 'do_gitk' which status bar to use.\n\nSigned-off-by: Pratyush Yadav <me@yadavpratyush.com>\n---\n git-gui.sh | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex f41ed2e..d939844 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2205,11 +2205,13 @@ proc do_gitk {revs {is_submodule false}} {\n \t\tset env(GIT_WORK_TREE) $_gitworktree\n \t\tcd $pwd\n\n-\t\tset status_operation [$::main_status \\\n-\t\t\tstart \\\n-\t\t\t[mc \"Starting %s... please wait...\" \"gitk\"]]\n+\t\tif {[info exists main_status]} {\n+\t\t\tset status_operation [$::main_status \\\n+\t\t\t\tstart \\\n+\t\t\t\t[mc \"Starting %s... please wait...\" \"gitk\"]]\n\n-\t\tafter 3500 [list $status_operation stop]\n+\t\t\tafter 3500 [list $status_operation stop]\n+\t\t}\n \t}\n }\n\n--\n2.21.1\n\n"},{"id":"392767","messageId":"20200303001033.GA138670@f3","threadId":"52927","inReplyTo":"20200302183538.7195-1-me@yadavpratyush.com","subject":"Re: [PATCH] git-gui: fix error popup when doing blame -> \"Show History Context\"","fromName":"Benjamin Poirier","fromEmail":"benjamin.poirier@gmail.com","sentAt":"2020-03-03T00:10:33Z","receivedAt":"2020-03-03T00:10:45Z","isPatch":true,"sender":{"key":"benjamin.poirier@gmail.com","avatar":null},"body":"On 2020/03/03 00:05 +0530, Pratyush Yadav wrote:\n> In d9c6469 (git-gui: update status bar to track operations, 2019-12-01)\n> the call to 'ui_status' in 'do_gitk' was updated to create the newly\n> introduced \"status bar operation\". This allowed this status text so show\n> along with other operations happening in parallel, and removed a race\n> between all these operations.\n> \n> But in that refactor, the fact that 'ui_status' checks for the existence\n> of 'main_status' was overlooked. This leads to an error message popping\n> up when the user selects \"Show History Context\" from the blame window\n> context menu on a source line. The error occurs because when running\n> \"blame\" 'main_status' is not initialized.\n> \n> So, add a check for the existence of 'main_status' in 'do_gitk'. This\n> fix reverts to the original behaviour. In the future, we might want to\n> look into a better way of telling 'do_gitk' which status bar to use.\n> \n> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>\n\nTested-by: Benjamin Poirier <benjamin.poirier@gmail.com>\n\nThank you for looking into this.\n"}]}