{"thread":{"id":"20988","subject":"[RFC/PATCH] branch: die when calling \"git branch [-a|-r] branchname\".","startedAt":"2009-09-17T09:35:28Z","lastAt":"2009-09-17T09:35:28Z","messageCount":1,"participants":["Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"123433","messageId":"1253180128-670-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"20988","inReplyTo":null,"subject":"[RFC/PATCH] branch: die when calling \"git branch [-a|-r] branchname\".","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2009-09-17T09:35:28Z","receivedAt":"2009-09-17T09:35:28Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n builtin-branch.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 9f57992..fe11b55 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -635,10 +635,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\trename_branch(head, argv[0], rename > 1);\n \telse if (rename && (argc == 2))\n \t\trename_branch(argv[0], argv[1], rename > 1);\n-\telse if (argc <= 2)\n+\telse if (argc <= 2) {\n+\t\tif (kinds != REF_LOCAL_BRANCH) {\n+\t\t\tdie(\"-a or -r do not make sense with branch name\");\n+\t\t}\n \t\tcreate_branch(head, argv[0], (argc == 2) ? argv[1] : head,\n \t\t\t      force_create, reflog, track);\n-\telse\n+\t} else\n \t\tusage_with_options(builtin_branch_usage, options);\n \n \treturn 0;\n-- \n1.6.5.rc1.11.g2d184.dirty\n"}]}