Merge branch 'nd/edit-branch-desc-while-detached' into HEAD
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 Jan 2013 17:01:41 +0000 (09:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Jan 2013 17:01:41 +0000 (09:01 -0800)
* nd/edit-branch-desc-while-detached:
  branch: no detached HEAD check when editing another branch's description

1  2 
builtin/branch.c

index 531a21e831f84bf9484548507e8428d662ecaa91,ea10bce3ba02dbc1afd804c2d91c7fc5a8445c10..ca61c5ba59e7286ebabea865f574976e240b5d2c
@@@ -852,14 -822,14 +852,14 @@@ int cmd_branch(int argc, const char **a
                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);
 +                      die(_("cannot edit description of more than one branch"));
  
                strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
                if (!ref_exists(branch_ref.buf)) {