Skip to content

Commit

Permalink
git-gui: Don't crash in citool mode on initial commit.
Browse files Browse the repository at this point in the history
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 <spearce@spearce.org>
  • Loading branch information
Shawn O. Pearce committed Feb 21, 2007
1 parent 7391b2e commit 9811937
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,6 @@ proc commit_committree {fd_wt curHEAD msg} {
return
}

# -- Make sure our current branch exists.
#
if {$commit_type eq {initial}} {
lappend all_heads $current_branch
set all_heads [lsort -unique $all_heads]
populate_branch_menu
}

# -- Cleanup after ourselves.
#
catch {file delete $msg_p}
Expand Down Expand Up @@ -1361,6 +1353,14 @@ proc commit_committree {fd_wt curHEAD msg} {

if {[is_enabled singlecommit]} do_quit

# -- Make sure our current branch exists.
#
if {$commit_type eq {initial}} {
lappend all_heads $current_branch
set all_heads [lsort -unique $all_heads]
populate_branch_menu
}

# -- Update in memory status
#
set selected_commit_type new
Expand Down

0 comments on commit 9811937

Please sign in to comment.