@matheusbsbs / matheus-bagliano / commits / 981193786f
Fork 0

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 <spearce@spearce.org>

Shawn O. Pearce committed Feb 21, 2007 at 01:33 UTC 981193786fc30b9ee73b9f223a75642b4ed455b9
1 file changed +8 -8
git-gui.sh
+8 -8
@@ -1318,14 +1318,6 @@ proc commit_committree {fd_wt curHEAD msg} {
1318 return
1319 }
1320
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 -
1321 # -- Cleanup after ourselves.
1322 #
1323 catch {file delete $msg_p}
@@ -1361,6 +1353,14 @@ proc commit_committree {fd_wt curHEAD msg} {
1353
1354 if {[is_enabled singlecommit]} do_quit
1355
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 +
1364 # -- Update in memory status
1365 #
1366 set selected_commit_type new