summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e97ca7f)
raw | patch | inline | side by side (parent: e97ca7f)
author | Matthieu Moy <Matthieu.Moy@imag.fr> | |
Wed, 30 Dec 2009 14:45:31 +0000 (15:45 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 31 Dec 2009 22:52:05 +0000 (14:52 -0800) |
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>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-branch.c | patch | blob | history | |
t/t5403-post-checkout-hook.sh | patch | blob | history |
diff --git a/builtin-branch.c b/builtin-branch.c
index 4b4abfd3639d2c6a1405e2e056ed5362b4b73abb..7dd51d1fed23dad3edfeedff9659618e9f276ea6 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
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;
index 9b2e1a94c5fb5aa094853a169cbdf2f7dc56e152..a7bef9371fc190d799e1e3741605fe8b626029c3 100755 (executable)
. ./test-lib.sh
test_expect_success setup '
- echo Data for commit0. >a &&
- echo Data for commit0. >b &&
- git update-index --add a &&
- git update-index --add b &&
- tree0=$(git write-tree) &&
- commit0=$(echo setup | git commit-tree $tree0) &&
- git update-ref refs/heads/master $commit0 &&
- git clone ./. clone1 &&
- git clone ./. clone2 &&
- GIT_DIR=clone2/.git git branch -a new2 &&
- echo Data for commit1. >clone2/b &&
- GIT_DIR=clone2/.git git add clone2/b &&
- GIT_DIR=clone2/.git git commit -m new2
+ echo Data for commit0. >a &&
+ echo Data for commit0. >b &&
+ git update-index --add a &&
+ git update-index --add b &&
+ tree0=$(git write-tree) &&
+ commit0=$(echo setup | git commit-tree $tree0) &&
+ git update-ref refs/heads/master $commit0 &&
+ git clone ./. clone1 &&
+ git clone ./. clone2 &&
+ GIT_DIR=clone2/.git git branch new2 &&
+ echo Data for commit1. >clone2/b &&
+ GIT_DIR=clone2/.git git add clone2/b &&
+ GIT_DIR=clone2/.git git commit -m new2
'
for clone in 1 2; do