branch: reject -D/-d without branch name
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 28 Jan 2013 01:18:14 +0000 (08:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Jan 2013 17:00:41 +0000 (09:00 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c

index 873f624..50fcacc 100644 (file)
@@ -837,9 +837,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                colopts = 0;
        }
 
-       if (delete)
+       if (delete) {
+               if (!argc)
+                       die(_("branch name required"));
                return delete_branches(argc, argv, delete > 1, kinds, quiet);
-       else if (list) {
+       else if (list) {
                int ret = print_ref_list(kinds, detached, verbose, abbrev,
                                         with_commit, argv);
                print_columns(&output, colopts, NULL);