Merge branch 'ft/transport-report-segv' into maint
[gitweb.git] / builtin / branch.c
index 1ec9c02612d0391984b484a5850f45c277a3e804..947c84be2daac5fd183c2d1fbd706e239eab63c5 100644 (file)
@@ -850,11 +850,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);