diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-02-15 16:35:32 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-16 02:49:33 +0300 |
commit | 0ebf4a2af3b72847327e977c5710fd123926570e (patch) | |
tree | 91fe7ca79b551c22bb5e87bee1898b6db0f59e81 /t/t2025-worktree-add.sh | |
parent | 494398473714dcbedb38b1ac79b531c7384b3bc4 (diff) |
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>
Diffstat (limited to 't/t2025-worktree-add.sh')
-rwxr-xr-x | t/t2025-worktree-add.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh index 0a804dab63..a4d36c0892 100755 --- a/t/t2025-worktree-add.sh +++ b/t/t2025-worktree-add.sh @@ -193,6 +193,14 @@ test_expect_success '"add" -B/--detach mutually exclusive' ' test_must_fail git worktree add -B poodle --detach bamboo master ' +test_expect_success 'add -B' ' + git worktree add -B poodle bamboo2 master^ && + git -C bamboo2 symbolic-ref HEAD >actual && + echo refs/heads/poodle >expected && + test_cmp expected actual && + test_cmp_rev master^ poodle +' + test_expect_success 'local clone from linked checkout' ' git clone --local here here-clone && ( cd here-clone && git fsck ) |