refname objects: do not prune
[git/mjg.git] / t / t1511-rev-parse-caret.sh
blobeaefc777bd98aeb4cae2ba34eec0e5fe2c2fbd72
1 #!/bin/sh
3 test_description='tests for ref^{stuff}'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 echo blob >a-blob &&
9 git tag -a -m blob blob-tag `git hash-object -w a-blob` &&
10 mkdir a-tree &&
11 echo moreblobs >a-tree/another-blob &&
12 git add . &&
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 &&
17 git branch ref &&
18 git checkout master &&
19 echo modified >>a-blob &&
20 git add -u &&
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
73 test_done