From: Shawn O. Pearce Date: Wed, 21 Feb 2007 06:33:59 +0000 (-0500) Subject: git-gui: Don't crash in citool mode on initial commit. X-Git-Tag: gitgui-0.6.1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b9a6216ee0a6c4be73a18bd4ba359ad2d07c2492;p=git.git 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 --- diff --git a/git-gui.sh b/git-gui.sh index 039e7bb93..f84ba3382 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -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} @@ -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