Skip to content

Commit

Permalink
Merge branch 'maint-1.6.0' into maint
Browse files Browse the repository at this point in the history
* maint-1.6.0:
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  • Loading branch information
Junio C Hamano committed Dec 31, 2009
2 parents 74fbd11 + 6e8f993 commit 9bfff3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
6 changes: 4 additions & 2 deletions builtin-branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions t/t5403-post-checkout-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bfff3a

Please sign in to comment.