summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-12-31 23:00:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-12-31 23:00:14 (GMT)
commit9bfff3ae5fdf1dcd0705056f7f9a42e81548797e (patch)
tree509488d440f0f8a7228189ce94e66d5acce5757f
parent74fbd1182a8300dd0a1d788120813b6d5b9e5cb6 (diff)
parent6e8f993a5a17f71edfd26a026bbc83cbbd3c0638 (diff)
downloadgit-9bfff3ae5fdf1dcd0705056f7f9a42e81548797e.zip
git-9bfff3ae5fdf1dcd0705056f7f9a42e81548797e.tar.gz
git-9bfff3ae5fdf1dcd0705056f7f9a42e81548797e.tar.bz2
Merge branch 'maint-1.6.0' into maint
* maint-1.6.0: branch: die explicitly why when calling "git branch [-a|-r] branchname".
-rw-r--r--builtin-branch.c6
-rwxr-xr-xt/t5403-post-checkout-hook.sh26
2 files changed, 17 insertions, 15 deletions
diff --git a/builtin-branch.c b/builtin-branch.c
index c87e63b..ddc9f2d 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -638,10 +638,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;
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 5858b86..d05a913 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -7,19 +7,19 @@ test_description='Test the post-checkout hook.'
. ./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