branch: no detached HEAD check when editing another branch's description
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 28 Jan 2013 01:18:13 +0000 (08:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Jan 2013 16:59:56 +0000 (08:59 -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 0e060f2e4a982efdda0f88d021e0a9d3f23c6b75..ea10bce3ba02dbc1afd804c2d91c7fc5a8445c10 100644 (file)
@@ -822,11 +822,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                const char *branch_name;
                struct strbuf branch_ref = STRBUF_INIT;
 
-               if (detached)
-                       die("Cannot give description to detached HEAD");
-               if (!argc)
+               if (!argc) {
+                       if (detached)
+                               die("Cannot give description to detached HEAD");
                        branch_name = head;
-               else if (argc == 1)
+               else if (argc == 1)
                        branch_name = argv[0];
                else
                        usage_with_options(builtin_branch_usage, options);