Skip to content

Commit 19195fb

Browse files
Isengartprati0100
authored andcommitted
Subject: git-gui: fix syntax error because of missing semicolon
For some asynchronous operations, we build a chain of callbacks to execute when the operation is done. These callbacks are held in $after, and a new callback can be added by appending to $after. Once the operation is done, $after is executed as a script. But if we don't append a semi-colon after the procedure calls, they will appear to Tcl as arguments to the previous procedure's arguments. So, for example, if $after is "foo", and we just append "bar", then $after becomes "foo bar", and bar will be treated as an argument to foo. If foo does not accept any optional arguments, it would result in Tcl throwing an error. If instead we do append a semi-colon, $after will look like "foo;bar;", and these will be treated as two separate procedure calls. Before d9c6469 (git-gui: update status bar to track operations, 2019-12-01), this problem was masked because ui_ready/ui_status did accept an optional argument. In d9c6469, ui_ready stopped accepting an optional argument, and this error started showing up. Another instance of this problem is when a call to ui_status without a trailing semicolon. ui_status never accepted an optional argument to begin with, but the issue never managed to surface. So, fix these errors by making sure we always append a semi-colon after procedure calls when multiple callbacks are involved in $after. Helped-by: Pratyush Yadav <[email protected]> Signed-off-by: Ansgar Röber <[email protected]>
1 parent a572802 commit 19195fb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

git-gui.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,12 +2600,12 @@ proc toggle_or_diff {mode w args} {
26002600
update_indexinfo \
26012601
"Unstaging [short_path $path] from commit" \
26022602
[list $path] \
2603-
[concat $after [list ui_ready]]
2603+
[concat $after {ui_ready;}]
26042604
} elseif {$w eq $ui_workdir} {
26052605
update_index \
26062606
"Adding [short_path $path]" \
26072607
[list $path] \
2608-
[concat $after [list ui_ready]]
2608+
[concat $after {ui_ready;}]
26092609
}
26102610
} else {
26112611
set selected_paths($path) 1

lib/index.tcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ proc rescan_on_error {err {after {}}} {
6060

6161
$::main_status stop_all
6262
unlock_index
63-
rescan [concat $after [list ui_ready]] 0
63+
rescan [concat $after {ui_ready;}] 0
6464
}
6565

6666
proc update_indexinfo {msg path_list after} {
@@ -314,7 +314,7 @@ proc unstage_helper {txt paths} {
314314
update_indexinfo \
315315
$txt \
316316
$path_list \
317-
[concat $after [list ui_ready]]
317+
[concat $after {ui_ready;}]
318318
}
319319
}
320320

@@ -366,7 +366,7 @@ proc add_helper {txt paths} {
366366
update_index \
367367
$txt \
368368
$path_list \
369-
[concat $after {ui_status [mc "Ready to commit."]}]
369+
[concat $after {ui_status [mc "Ready to commit."];}]
370370
}
371371
}
372372

lib/mergetool.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ proc merge_add_resolution {path} {
5959
update_index \
6060
[mc "Adding resolution for %s" [short_path $path]] \
6161
[list $path] \
62-
[concat $after [list ui_ready]]
62+
[concat $after {ui_ready;}]
6363
}
6464

6565
proc merge_force_stage {stage} {

0 commit comments

Comments
 (0)