git-gui: Give a better error message on an empty branch name.
New branches must have a name. An empty one is not a valid ref, but the generic message "We do not like '' as a branch name." is just too vague or difficult to read. So detect the missing name early and tell the user it must be entered. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 21, 2007 at 15:40 UTC
e754d6efe7810f5f2c6cbd48dca21f1bc84a6a5e
1 file changed
+10
git-gui.sh
+10
@@ -1696,6 +1696,16 @@ proc do_create_branch_action {w} {
1696
global create_branch_head create_branch_trackinghead
1697
1698
set newbranch [string trim [$w.desc.name_t get 0.0 end]]
1699
+ if {$newbranch eq {}} {
1700
+ tk_messageBox \
1701
+ -icon error \
1702
+ -type ok \
1703
+ -title [wm title $w] \
1704
+ -parent $w \
1705
+ -message "Please supply a branch name."
1706
+ focus $w.desc.name_t
1707
+ return
1708
+ }
1709
if {![catch {exec git show-ref --verify -- "refs/heads/$newbranch"}]} {
1710
tk_messageBox \
1711
-icon error \