summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-05-30 15:27:49 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-05-30 23:34:40 (GMT)
commit905d9c9653a7dc324a1c6fbf883a1b9bcdc6e5bf (patch)
treedbfe5e13e842e641a4d8f61e5748fe270a2ea69d /lib
parentea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813 (diff)
downloadgit-905d9c9653a7dc324a1c6fbf883a1b9bcdc6e5bf.zip
git-905d9c9653a7dc324a1c6fbf883a1b9bcdc6e5bf.tar.gz
git-905d9c9653a7dc324a1c6fbf883a1b9bcdc6e5bf.tar.bz2
git-gui: Allow creating a branch when none exists
If the user has no branches at all (their refs/heads/ is empty) and they are on a detached HEAD we have a valid repository but there are no branches to populate into the branch pulldown in the create branch dialog. Instead of erroring out we can skip that part of the dialog, much like we do with tracking branches or tags when the user doesn't have any. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/branch.tcl14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/branch.tcl b/lib/branch.tcl
index caaee5c..4f648b2 100644
--- a/lib/branch.tcl
+++ b/lib/branch.tcl
@@ -201,12 +201,14 @@ proc do_create_branch {} {
pack $w.desc -anchor nw -fill x -pady 5 -padx 5
labelframe $w.from -text {Starting Revision}
- radiobutton $w.from.head_r \
- -text {Local Branch:} \
- -value head \
- -variable create_branch_revtype
- eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
- grid $w.from.head_r $w.from.head_m -sticky w
+ if {$all_heads ne {}} {
+ radiobutton $w.from.head_r \
+ -text {Local Branch:} \
+ -value head \
+ -variable create_branch_revtype
+ eval tk_optionMenu $w.from.head_m create_branch_head $all_heads
+ grid $w.from.head_r $w.from.head_m -sticky w
+ }
set all_trackings [all_tracking_branches]
if {$all_trackings ne {}} {
set create_branch_trackinghead [lindex $all_trackings 0]