提交 9bfff3ae 编写于 作者: J Junio C Hamano

Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
......@@ -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;
......
......@@ -16,7 +16,7 @@ test_expect_success setup '
git update-ref refs/heads/master $commit0 &&
git clone ./. clone1 &&
git clone ./. clone2 &&
GIT_DIR=clone2/.git git branch -a new2 &&
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册