summaryrefslogtreecommitdiff
path: root/builtin-branch.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2009-12-30 15:45:31 +0100
committerJunio C Hamano <gitster@pobox.com>2009-12-31 14:52:05 -0800
commit6e8f993a5a17f71edfd26a026bbc83cbbd3c0638 (patch)
tree538b54ada8806479fd013931a10f1774f99499d7 /builtin-branch.c
parente97ca7f41f2b9bbdfc93d103c3f64337bb6dcc20 (diff)
downloadgit-6e8f993a5a17f71edfd26a026bbc83cbbd3c0638.tar.gz
branch: die explicitly why when calling "git branch [-a|-r] branchname".
The -a and -r options used to be silently ignored in such a command. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r--builtin-branch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-branch.c b/builtin-branch.c
index 4b4abfd363..7dd51d1fed 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -582,10 +582,12 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
rename_branch(head, argv[0], rename > 1);
else if (rename && (argc == 2))
rename_branch(argv[0], argv[1], rename > 1);
- else if (argc <= 2)
+ else if (argc <= 2) {
+ if (kinds != REF_LOCAL_BRANCH)
+ die("-a and -r options to 'git branch' do not make sense with a branch name");
create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
force_create, reflog, track);
- else
+ } else
usage_with_options(builtin_branch_usage, options);
return 0;