worktree: add: suppress auto-vivication with --detach and no <branch>
commit5c942570fe2a48d8fde348e89392c2e9e23aa483
authorEric Sunshine <sunshine@sunshineco.com>
Fri, 17 Jul 2015 23:00:09 +0000 (17 19:00 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jul 2015 18:29:51 +0000 (20 11:29 -0700)
tree1be8561173a8f4d7f33066ee3158f1549b8b968e
parentab0b2c53ed853e34def18e7b84acd7da7e2ddd49
worktree: add: suppress auto-vivication with --detach and no <branch>

Fix oversight where branch auto-vivication incorrectly kicks in when
--detach is specified and <branch> omitted. Instead, treat:

    git worktree add --detach <path>

as shorthand for:

    git worktree add --detach <path> HEAD

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-worktree.txt
builtin/worktree.c
t/t2025-worktree-add.sh