diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2017-04-24 12:01:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-25 06:28:55 +0200 |
commit | fa099d23227f88b5a1cd79c646551130d9b36e6d (patch) | |
tree | f5308d3f4b446b027099b9720070023f5f2fa89a /t/t1407-worktree-ref-store.sh | |
parent | refs: introduce get_worktree_ref_store() (diff) | |
download | git-fa099d23227f88b5a1cd79c646551130d9b36e6d.tar.xz git-fa099d23227f88b5a1cd79c646551130d9b36e6d.zip |
worktree.c: kill parse_ref() in favor of refs_resolve_ref_unsafe()
The manual parsing code is replaced with a call to refs_resolve_ref_unsafe().
The manual parsing code must die because only refs/files-backend.c
should do that.
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/t1407-worktree-ref-store.sh')
-rwxr-xr-x | t/t1407-worktree-ref-store.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh new file mode 100755 index 0000000000..04d1e9d177 --- /dev/null +++ b/t/t1407-worktree-ref-store.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +test_description='test worktree ref store api' + +. ./test-lib.sh + +RWT="test-ref-store worktree:wt" +RMAIN="test-ref-store worktree:main" + +test_expect_success 'setup' ' + test_commit first && + git worktree add -b wt-master wt && + ( + cd wt && + test_commit second + ) +' + +test_expect_success 'resolve_ref(<shared-ref>)' ' + SHA1=`git rev-parse master` && + echo "$SHA1 refs/heads/master 0x0" >expected && + $RWT resolve-ref refs/heads/master 0 >actual && + test_cmp expected actual && + $RMAIN resolve-ref refs/heads/master 0 >actual && + test_cmp expected actual +' + +test_expect_success 'resolve_ref(<per-worktree-ref>)' ' + SHA1=`git -C wt rev-parse HEAD` && + echo "$SHA1 refs/heads/wt-master 0x1" >expected && + $RWT resolve-ref HEAD 0 >actual && + test_cmp expected actual && + + SHA1=`git rev-parse HEAD` && + echo "$SHA1 refs/heads/master 0x1" >expected && + $RMAIN resolve-ref HEAD 0 >actual && + test_cmp expected actual +' + +test_done |