worktree: add: make -b/-B default to HEAD when <branch> is omitted

As a convenience, like "git branch" and "git checkout -b", make
"git worktree add -b <newbranch> <path> <branch>" default to HEAD when
<branch> is omitted.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Eric Sunshine
2015-07-06 13:30:58 -04:00
committed by Junio C Hamano
parent f5682b2a86
commit 0f4af3b9ea
3 changed files with 10 additions and 2 deletions

View File

@ -140,4 +140,9 @@ test_expect_success '"add" from relative HEAD' '
test_cmp expected actual
'
test_expect_success '"add -b" with <branch> omitted' '
git worktree add -b burble flornk &&
test_cmp_rev HEAD burble
'
test_done