From e754d6efe7810f5f2c6cbd48dca21f1bc84a6a5e Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 21 Jan 2007 15:40:55 -0500 Subject: [PATCH] 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 --- git-gui.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index c4ab824b9..0f98d2cce 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1696,6 +1696,16 @@ proc do_create_branch_action {w} { global create_branch_head create_branch_trackinghead set newbranch [string trim [$w.desc.name_t get 0.0 end]] + if {$newbranch eq {}} { + tk_messageBox \ + -icon error \ + -type ok \ + -title [wm title $w] \ + -parent $w \ + -message "Please supply a branch name." + focus $w.desc.name_t + return + } if {![catch {exec git show-ref --verify -- "refs/heads/$newbranch"}]} { tk_messageBox \ -icon error \ -- 2.26.2