Skip to content

Commit 9811937

Browse files
committed
git-gui: Don't crash in citool mode on initial commit.
Attempting to use `git citool` to create an initial commit caused git-gui to crash with a Tcl error as it tried to add the newly born branch to the non-existant branch menu. Moving this code to after the normal commit cleanup logic resolves the issue, as we only have a branch menu if we are not in singlecommit mode. Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 7391b2e commit 9811937

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

git-gui.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,14 +1318,6 @@ proc commit_committree {fd_wt curHEAD msg} {
13181318
return
13191319
}
13201320

1321-
# -- Make sure our current branch exists.
1322-
#
1323-
if {$commit_type eq {initial}} {
1324-
lappend all_heads $current_branch
1325-
set all_heads [lsort -unique $all_heads]
1326-
populate_branch_menu
1327-
}
1328-
13291321
# -- Cleanup after ourselves.
13301322
#
13311323
catch {file delete $msg_p}
@@ -1361,6 +1353,14 @@ proc commit_committree {fd_wt curHEAD msg} {
13611353

13621354
if {[is_enabled singlecommit]} do_quit
13631355

1356+
# -- Make sure our current branch exists.
1357+
#
1358+
if {$commit_type eq {initial}} {
1359+
lappend all_heads $current_branch
1360+
set all_heads [lsort -unique $all_heads]
1361+
populate_branch_menu
1362+
}
1363+
13641364
# -- Update in memory status
13651365
#
13661366
set selected_commit_type new

0 commit comments

Comments
 (0)