worktree: fix "add -B"
commit0ebf4a2af3b72847327e977c5710fd123926570e
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 15 Feb 2016 13:35:32 +0000 (15 20:35 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Feb 2016 23:49:33 +0000 (15 15:49 -0800)
tree91fe7ca79b551c22bb5e87bee1898b6db0f59e81
parent494398473714dcbedb38b1ac79b531c7384b3bc4
worktree: fix "add -B"

Current code does not update "symref" when -B is used. This string
contains the new HEAD. Because it's empty "git worktree add -B" fails at
symbolic-ref step.

Because branch creation is already done before calling add_worktree(),
-B is equivalent to -b from add_worktree() point of view. We do not need
the special case for -B.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/worktree.c
t/t2025-worktree-add.sh