3 test_description
='tests for ref^{stuff}'
7 test_expect_success
'setup' '
9 git tag -a -m blob blob-tag `git hash-object -w a-blob` &&
11 echo moreblobs >a-tree/another-blob &&
13 TREE_SHA1=`git write-tree` &&
14 git tag -a -m tree tree-tag "$TREE_SHA1" &&
15 git commit -m Initial &&
16 git tag -a -m commit commit-tag &&
18 git checkout master &&
19 echo modified >>a-blob &&
21 git commit -m Modified
24 test_expect_success
'ref^{non-existent}' '
25 test_must_fail git rev-parse ref^{non-existent}
28 test_expect_success
'ref^{}' '
29 git rev-parse ref >expected &&
30 git rev-parse ref^{} >actual &&
31 test_cmp expected actual &&
32 git rev-parse commit-tag^{} >actual &&
33 test_cmp expected actual
36 test_expect_success
'ref^{commit}' '
37 git rev-parse ref >expected &&
38 git rev-parse ref^{commit} >actual &&
39 test_cmp expected actual &&
40 git rev-parse commit-tag^{commit} >actual &&
41 test_cmp expected actual &&
42 test_must_fail git rev-parse tree-tag^{commit} &&
43 test_must_fail git rev-parse blob-tag^{commit}
46 test_expect_success
'ref^{tree}' '
47 echo $TREE_SHA1 >expected &&
48 git rev-parse ref^{tree} >actual &&
49 test_cmp expected actual &&
50 git rev-parse commit-tag^{tree} >actual &&
51 test_cmp expected actual &&
52 git rev-parse tree-tag^{tree} >actual &&
53 test_cmp expected actual &&
54 test_must_fail git rev-parse blob-tag^{tree}
57 test_expect_success
'ref^{/.}' '
58 git rev-parse master >expected &&
59 git rev-parse master^{/.} >actual &&
60 test_cmp expected actual
63 test_expect_success
'ref^{/non-existent}' '
64 test_must_fail git rev-parse master^{/non-existent}
67 test_expect_success
'ref^{/Initial}' '
68 git rev-parse ref >expected &&
69 git rev-parse master^{/Initial} >actual &&
70 test_cmp expected actual