3 test_description='test worktree ref store api'
7 RWT="test-ref-store worktree:wt"
8 RMAIN="test-ref-store worktree:main"
10 test_expect_success 'setup' '
12 git worktree add -b wt-master wt &&
19 test_expect_success 'resolve_ref(<shared-ref>)' '
20 SHA1=`git rev-parse master` &&
21 echo "$SHA1 refs/heads/master 0x0" >expected &&
22 $RWT resolve-ref refs/heads/master 0 >actual &&
23 test_cmp expected actual &&
24 $RMAIN resolve-ref refs/heads/master 0 >actual &&
25 test_cmp expected actual
28 test_expect_success 'resolve_ref(<per-worktree-ref>)' '
29 SHA1=`git -C wt rev-parse HEAD` &&
30 echo "$SHA1 refs/heads/wt-master 0x1" >expected &&
31 $RWT resolve-ref HEAD 0 >actual &&
32 test_cmp expected actual &&
34 SHA1=`git rev-parse HEAD` &&
35 echo "$SHA1 refs/heads/master 0x1" >expected &&
36 $RMAIN resolve-ref HEAD 0 >actual &&
37 test_cmp expected actual
40 test_expect_success 'create_symref(FOO, refs/heads/master)' '
41 $RWT create-symref FOO refs/heads/master nothing &&
42 echo refs/heads/master >expected &&
43 git -C wt symbolic-ref FOO >actual &&
44 test_cmp expected actual &&
46 $RMAIN create-symref FOO refs/heads/wt-master nothing &&
47 echo refs/heads/wt-master >expected &&
48 git symbolic-ref FOO >actual &&
49 test_cmp expected actual