@@ -7,24 +7,55 @@ test_description='direct path-walk API tests'
77test_expect_success ' setup test repository' '
88 git checkout -b base &&
99
10+ # Make some objects that will only be reachable
11+ # via non-commit tags.
12+ mkdir child &&
13+ echo file >child/file &&
14+ git add child &&
15+ git commit -m "will abandon" &&
16+ git tag -a -m "tree" tree-tag HEAD^{tree} &&
17+ echo file2 >file2 &&
18+ git add file2 &&
19+ git commit --amend -m "will abandon" &&
20+ git tag tree-tag2 HEAD^{tree} &&
21+
22+ echo blob >file &&
23+ blob_oid=$(git hash-object -t blob -w --stdin <file) &&
24+ git tag -a -m "blob" blob-tag "$blob_oid" &&
25+ echo blob2 >file2 &&
26+ blob2_oid=$(git hash-object -t blob -w --stdin <file2) &&
27+ git tag blob-tag2 "$blob2_oid" &&
28+
29+ rm -fr child file file2 &&
30+
1031 mkdir left &&
1132 mkdir right &&
1233 echo a >a &&
1334 echo b >left/b &&
1435 echo c >right/c &&
1536 git add . &&
16- git commit -m "first" &&
37+ git commit --amend -m "first" &&
38+ git tag -m "first" first HEAD &&
1739
1840 echo d >right/d &&
1941 git add right &&
2042 git commit -m "second" &&
43+ git tag -a -m "second (under)" second.1 HEAD &&
44+ git tag -a -m "second (top)" second.2 second.1 &&
2145
46+ # Set up file/dir collision in history.
47+ rm a &&
48+ mkdir a &&
49+ echo a >a/a &&
2250 echo bb >left/b &&
23- git commit -a -m "third" &&
51+ git add a left &&
52+ git commit -m "third" &&
53+ git tag -a -m "third" third &&
2454
2555 git checkout -b topic HEAD~1 &&
2656 echo cc >right/c &&
27- git commit -a -m "topic"
57+ git commit -a -m "topic" &&
58+ git tag -a -m "fourth" fourth
2859'
2960
3061test_expect_success ' all' '
@@ -40,19 +71,35 @@ test_expect_success 'all' '
4071 TREE::$(git rev-parse base^{tree})
4172 TREE::$(git rev-parse base~1^{tree})
4273 TREE::$(git rev-parse base~2^{tree})
74+ TREE::$(git rev-parse refs/tags/tree-tag^{})
75+ TREE::$(git rev-parse refs/tags/tree-tag2^{})
76+ TREE:a/:$(git rev-parse base:a)
4377 TREE:left/:$(git rev-parse base:left)
4478 TREE:left/:$(git rev-parse base~2:left)
4579 TREE:right/:$(git rev-parse topic:right)
4680 TREE:right/:$(git rev-parse base~1:right)
4781 TREE:right/:$(git rev-parse base~2:right)
48- trees:9
82+ TREE:child/:$(git rev-parse refs/tags/tree-tag^{}:child)
83+ trees:13
4984 BLOB:a:$(git rev-parse base~2:a)
85+ BLOB:file2:$(git rev-parse refs/tags/tree-tag2^{}:file2)
5086 BLOB:left/b:$(git rev-parse base~2:left/b)
5187 BLOB:left/b:$(git rev-parse base:left/b)
5288 BLOB:right/c:$(git rev-parse base~2:right/c)
5389 BLOB:right/c:$(git rev-parse topic:right/c)
5490 BLOB:right/d:$(git rev-parse base~1:right/d)
55- blobs:6
91+ BLOB:/tagged-blobs:$(git rev-parse refs/tags/blob-tag^{})
92+ BLOB:/tagged-blobs:$(git rev-parse refs/tags/blob-tag2^{})
93+ BLOB:child/file:$(git rev-parse refs/tags/tree-tag^{}:child/file)
94+ blobs:10
95+ TAG::$(git rev-parse refs/tags/first)
96+ TAG::$(git rev-parse refs/tags/second.1)
97+ TAG::$(git rev-parse refs/tags/second.2)
98+ TAG::$(git rev-parse refs/tags/third)
99+ TAG::$(git rev-parse refs/tags/fourth)
100+ TAG::$(git rev-parse refs/tags/tree-tag)
101+ TAG::$(git rev-parse refs/tags/blob-tag)
102+ tags:7
56103 EOF
57104
58105 sort expect >expect.sorted &&
@@ -83,6 +130,7 @@ test_expect_success 'topic only' '
83130 BLOB:right/c:$(git rev-parse topic:right/c)
84131 BLOB:right/d:$(git rev-parse base~1:right/d)
85132 blobs:5
133+ tags:0
86134 EOF
87135
88136 sort expect >expect.sorted &&
@@ -106,6 +154,7 @@ test_expect_success 'topic, not base' '
106154 BLOB:right/c:$(git rev-parse topic:right/c)
107155 BLOB:right/d:$(git rev-parse topic:right/d)
108156 blobs:4
157+ tags:0
109158 EOF
110159
111160 sort expect >expect.sorted &&
@@ -126,6 +175,7 @@ test_expect_success 'topic, not base, only blobs' '
126175 BLOB:right/c:$(git rev-parse topic:right/c)
127176 BLOB:right/d:$(git rev-parse topic:right/d)
128177 blobs:4
178+ tags:0
129179 EOF
130180
131181 sort expect >expect.sorted &&
@@ -145,6 +195,7 @@ test_expect_success 'topic, not base, only commits' '
145195 commits:1
146196 trees:0
147197 blobs:0
198+ tags:0
148199 EOF
149200
150201 sort expect >expect.sorted &&
@@ -164,6 +215,7 @@ test_expect_success 'topic, not base, only trees' '
164215 TREE:right/:$(git rev-parse topic:right)
165216 trees:3
166217 blobs:0
218+ tags:0
167219 EOF
168220
169221 sort expect >expect.sorted &&
@@ -191,6 +243,7 @@ test_expect_success 'topic, not base, boundary' '
191243 BLOB:right/c:$(git rev-parse topic:right/c)
192244 BLOB:right/d:$(git rev-parse base~1:right/d)
193245 blobs:5
246+ tags:0
194247 EOF
195248
196249 sort expect >expect.sorted &&
0 commit comments