config.txt: move sendemail part out to a separate file
[git.git] / t / t1511-rev-parse-caret.sh
blobe0a49a651fdd3b3f7d9e0f24e00439c9642f896c
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 &&
22 git branch modref &&
23 echo changed! >>a-blob &&
24 git add -u &&
25 git commit -m !Exp &&
26 git branch expref &&
27 echo changed >>a-blob &&
28 git add -u &&
29 git commit -m Changed &&
30 echo changed-again >>a-blob &&
31 git add -u &&
32 git commit -m Changed-again
35 test_expect_success 'ref^{non-existent}' '
36 test_must_fail git rev-parse ref^{non-existent}
39 test_expect_success 'ref^{}' '
40 git rev-parse ref >expected &&
41 git rev-parse ref^{} >actual &&
42 test_cmp expected actual &&
43 git rev-parse commit-tag^{} >actual &&
44 test_cmp expected actual
47 test_expect_success 'ref^{commit}' '
48 git rev-parse ref >expected &&
49 git rev-parse ref^{commit} >actual &&
50 test_cmp expected actual &&
51 git rev-parse commit-tag^{commit} >actual &&
52 test_cmp expected actual &&
53 test_must_fail git rev-parse tree-tag^{commit} &&
54 test_must_fail git rev-parse blob-tag^{commit}
57 test_expect_success 'ref^{tree}' '
58 echo $TREE_SHA1 >expected &&
59 git rev-parse ref^{tree} >actual &&
60 test_cmp expected actual &&
61 git rev-parse commit-tag^{tree} >actual &&
62 test_cmp expected actual &&
63 git rev-parse tree-tag^{tree} >actual &&
64 test_cmp expected actual &&
65 test_must_fail git rev-parse blob-tag^{tree}
68 test_expect_success 'ref^{tag}' '
69 test_must_fail git rev-parse HEAD^{tag} &&
70 git rev-parse commit-tag >expected &&
71 git rev-parse commit-tag^{tag} >actual &&
72 test_cmp expected actual
75 test_expect_success 'ref^{/.}' '
76 git rev-parse master >expected &&
77 git rev-parse master^{/.} >actual &&
78 test_cmp expected actual
81 test_expect_success 'ref^{/non-existent}' '
82 test_must_fail git rev-parse master^{/non-existent}
85 test_expect_success 'ref^{/Initial}' '
86 git rev-parse ref >expected &&
87 git rev-parse master^{/Initial} >actual &&
88 test_cmp expected actual
91 test_expect_success 'ref^{/!Exp}' '
92 test_must_fail git rev-parse master^{/!Exp}
95 test_expect_success 'ref^{/!}' '
96 test_must_fail git rev-parse master^{/!}
99 test_expect_success 'ref^{/!!Exp}' '
100 git rev-parse expref >expected &&
101 git rev-parse master^{/!!Exp} >actual &&
102 test_cmp expected actual
105 test_expect_success 'ref^{/!-}' '
106 test_must_fail git rev-parse master^{/!-}
109 test_expect_success 'ref^{/!-.}' '
110 test_must_fail git rev-parse master^{/!-.}
113 test_expect_success 'ref^{/!-non-existent}' '
114 git rev-parse master >expected &&
115 git rev-parse master^{/!-non-existent} >actual &&
116 test_cmp expected actual
119 test_expect_success 'ref^{/!-Changed}' '
120 git rev-parse expref >expected &&
121 git rev-parse master^{/!-Changed} >actual &&
122 test_cmp expected actual
125 test_expect_success 'ref^{/!-!Exp}' '
126 git rev-parse modref >expected &&
127 git rev-parse expref^{/!-!Exp} >actual &&
128 test_cmp expected actual
131 test_done