From e21594a998d71eff39d80af878162abe94ef6e17 Mon Sep 17 00:00:00 2001
From: "Shawn O. Pearce" <spearce@spearce.org>
Date: Sun, 21 Jan 2007 04:57:11 -0500
Subject: [PATCH] git-gui: Attempt to checkout the new branch after creation.

If the user asked us to checkout the branch after creating it then
we should try to do so.  This may fail, especially right now since
branch switching from within git-gui is not supported.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 git-gui.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index e79a0ae073..ae1f0248f5 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1674,6 +1674,9 @@ proc do_create_branch_action {w} {
 	set all_heads [lsort $all_heads]
 	populate_branch_menu
 	destroy $w
+	if {$create_branch_checkout} {
+		switch_branch $newbranch
+	}
 }
 
 proc do_create_branch {} {
@@ -1681,7 +1684,7 @@ proc do_create_branch {} {
 	global create_branch_checkout create_branch_revtype
 	global create_branch_head create_branch_trackinghead
 
-	set create_branch_checkout true
+	set create_branch_checkout 1
 	set create_branch_revtype head
 	set create_branch_head $current_branch
 	set create_branch_trackinghead {}
@@ -1792,8 +1795,6 @@ proc do_create_branch {} {
 		-font font_ui
 	checkbutton $w.postActions.checkout \
 		-text {Checkout after creation} \
-		-offvalue false \
-		-onvalue true \
 		-variable create_branch_checkout \
 		-font font_ui
 	pack $w.postActions.checkout -anchor nw