3 #include "test_helpers.h"
7 * read loose objects from the object directory. The objects are
8 * written using the "in-pack" object encoding, using an zlib
9 * compression level of Z_DEFAULT_COMPRESSION (6). See also
12 * Note that the tree and tag objects are not actually stored in
13 * the "in-pack" format. This is due to a bug in git v1.5.2, since
14 * git-write-tree and git-mktag did not call git_default_config()
15 * and, therefore, did not honor the "core.legacyheaders" config
19 static char *odb_dir
= "test-objects";
21 /* commit == 3d7f8a6af076c8c3f20071a8935cdbe8228594d1 */
22 static unsigned char commit_bytes
[] = {
23 0x92, 0x16, 0x78, 0x9c, 0x85, 0x90, 0x3d, 0x6e,
24 0xc3, 0x30, 0x0c, 0x85, 0x77, 0x9d, 0x82, 0x7b,
25 0xeb, 0xc0, 0x52, 0x53, 0x58, 0x2e, 0x82, 0xa2,
26 0x41, 0xe7, 0x20, 0x43, 0xd3, 0x03, 0x48, 0x11,
27 0x65, 0x0b, 0xb0, 0x28, 0x43, 0x3f, 0x40, 0x7c,
28 0xfb, 0x28, 0x70, 0x61, 0x74, 0x6a, 0xc9, 0xe5,
29 0xf1, 0x91, 0xdf, 0x1b, 0x98, 0x23, 0x22, 0x18,
30 0x6b, 0x85, 0x51, 0x7d, 0xab, 0xc5, 0xeb, 0x1e,
31 0xb9, 0x46, 0x2d, 0x65, 0x6f, 0xb8, 0xad, 0x2d,
32 0xa4, 0xd4, 0xc8, 0x65, 0xfb, 0xd2, 0x49, 0x61,
33 0x2c, 0x53, 0x25, 0x8f, 0x21, 0xc2, 0x11, 0xbe,
34 0xe1, 0xf2, 0x10, 0x87, 0xd5, 0xf8, 0xc0, 0x9b,
35 0xf2, 0xf3, 0x84, 0xbb, 0x6b, 0xf0, 0xef, 0xc0,
36 0x85, 0xe8, 0x24, 0xdf, 0x8b, 0xbe, 0x83, 0xa7,
37 0xb6, 0x16, 0xab, 0xae, 0x77, 0x39, 0x63, 0x84,
38 0x4f, 0x38, 0xc3, 0x69, 0x95, 0x87, 0xcd, 0xfd,
39 0x87, 0x66, 0x47, 0x08, 0x84, 0xcd, 0xe4, 0x08,
40 0x61, 0x65, 0x20, 0x15, 0xef, 0x55, 0x5c, 0x18,
41 0xbb, 0x8c, 0x08, 0x3a, 0x98, 0x05, 0x82, 0x85,
42 0x3c, 0x6e, 0x7b, 0x8f, 0x29, 0xa9, 0x01, 0x9f,
43 0xeb, 0x4c, 0x59, 0x39, 0x72, 0x34, 0x80, 0x2d,
44 0xb1, 0x5e, 0x44, 0xc0, 0xdb, 0x3c, 0x29, 0x52,
45 0xd9, 0x05, 0x62, 0x3f, 0xd4, 0x5c, 0xe2, 0x1c,
46 0x12, 0x6e, 0x21, 0xa3, 0xa2, 0x01, 0x13, 0x38,
47 0xca, 0x31, 0x98, 0x72, 0x45, 0x03, 0x7a, 0xf9,
48 0x15, 0xbf, 0x63, 0xec, 0xcb, 0x0d, 0x84, 0xa6,
49 0x09, 0xb6, 0xd1, 0xcb, 0xdb, 0xdf, 0xef, 0x60,
50 0x77, 0x51, 0x90, 0x74, 0xf0,
53 static unsigned char commit_data
[] = {
54 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
55 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
56 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
57 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
58 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
59 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
60 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
61 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
62 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
63 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
64 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
65 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
66 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
67 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
68 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
69 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
70 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
71 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
72 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
73 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
74 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
75 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
76 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
77 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
78 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
79 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
80 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
81 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
82 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
83 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
84 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
85 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
86 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
87 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
88 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
89 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
90 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
91 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
92 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
93 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
94 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
95 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
96 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
97 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
101 static object_data commit
= {
103 sizeof(commit_bytes
),
104 "3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
107 "test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
112 /* tree == dff2da90b254e1beb889d1f1f1288be1803782df */
113 static unsigned char tree_bytes
[] = {
114 0x78, 0x9c, 0x2b, 0x29, 0x4a, 0x4d, 0x55, 0x30,
115 0x34, 0x32, 0x63, 0x30, 0x34, 0x30, 0x30, 0x33,
116 0x31, 0x51, 0xc8, 0xcf, 0x4b, 0x65, 0xe8, 0x16,
117 0xae, 0x98, 0x58, 0x29, 0xff, 0x32, 0x53, 0x7d,
118 0x6d, 0xc5, 0x33, 0x6f, 0xae, 0xb5, 0xd5, 0xf7,
119 0x2e, 0x74, 0xdf, 0x81, 0x4a, 0x17, 0xe7, 0xe7,
120 0xa6, 0x32, 0xfc, 0x6d, 0x31, 0xd8, 0xd3, 0xe6,
121 0xf3, 0xe7, 0xea, 0x47, 0xbe, 0xd0, 0x09, 0x3f,
122 0x96, 0xb8, 0x3f, 0x90, 0x9e, 0xa2, 0xfd, 0x0f,
123 0x2a, 0x5f, 0x52, 0x9e, 0xcf, 0x50, 0x31, 0x43,
124 0x52, 0x29, 0xd1, 0x5a, 0xeb, 0x77, 0x82, 0x2a,
125 0x8b, 0xfe, 0xb7, 0xbd, 0xed, 0x5d, 0x07, 0x67,
126 0xfa, 0xb5, 0x42, 0xa5, 0xab, 0x52, 0x8b, 0xf2,
127 0x19, 0x9e, 0xcd, 0x7d, 0x34, 0x7b, 0xd3, 0xc5,
128 0x6b, 0xce, 0xde, 0xdd, 0x9a, 0xeb, 0xca, 0xa3,
129 0x6e, 0x1c, 0x7a, 0xd2, 0x13, 0x3c, 0x11, 0x00,
130 0xe2, 0xaa, 0x38, 0x57,
133 static unsigned char tree_data
[] = {
134 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
135 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
136 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
137 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
138 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
139 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
140 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
141 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
142 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
143 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
144 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
145 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
146 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
147 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
148 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
149 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
152 static object_data tree
= {
155 "dff2da90b254e1beb889d1f1f1288be1803782df",
158 "test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
163 /* tag == 09d373e1dfdc16b129ceec6dd649739911541e05 */
164 static unsigned char tag_bytes
[] = {
165 0x78, 0x9c, 0x35, 0x8e, 0xcb, 0x0a, 0xc2, 0x30,
166 0x10, 0x45, 0x5d, 0xe7, 0x2b, 0x66, 0x2f, 0x84,
167 0x3c, 0xda, 0x66, 0x0a, 0x22, 0x82, 0x6b, 0x71,
168 0xe3, 0x0f, 0xa4, 0xe9, 0xa4, 0x0f, 0x5a, 0x52,
169 0xda, 0x41, 0xf4, 0xef, 0x4d, 0x51, 0x87, 0x59,
170 0x1c, 0x2e, 0x97, 0x33, 0xc3, 0xbe, 0x03, 0xed,
171 0xec, 0x21, 0x35, 0x23, 0x05, 0x06, 0xdb, 0xba,
172 0x88, 0xbe, 0xf2, 0x51, 0xb9, 0x2a, 0x60, 0xb0,
173 0xd1, 0x28, 0xe5, 0xb4, 0xc7, 0xda, 0x96, 0xa1,
174 0x6d, 0x08, 0x8d, 0xc1, 0xb2, 0x2e, 0x5a, 0x2d,
175 0xf8, 0xbd, 0x10, 0x84, 0x34, 0xcf, 0x03, 0x0b,
176 0xce, 0x8e, 0xa7, 0x92, 0x4a, 0xea, 0x1d, 0x3b,
177 0x5a, 0xe1, 0x0a, 0x77, 0xb8, 0x0d, 0xcc, 0x19,
178 0x4f, 0xdf, 0x52, 0xc6, 0x0b, 0xbd, 0xfc, 0xbc,
179 0x4c, 0x24, 0x73, 0x72, 0x06, 0x6d, 0x8c, 0x43,
180 0x5d, 0x98, 0xda, 0xc1, 0x51, 0xe5, 0x11, 0xe2,
181 0xd1, 0x0f, 0x1b, 0xe4, 0xe5, 0x9e, 0x60, 0x57,
182 0xfe, 0x5e, 0x8a, 0x69, 0x85, 0x95, 0x26, 0xf2,
183 0x1b, 0xfd, 0xaf, 0x7c, 0x00, 0x42, 0x9a, 0x36,
187 static unsigned char tag_data
[] = {
188 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
189 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
190 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
191 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
192 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
193 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
194 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
195 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
196 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
197 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
198 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
199 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
200 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
201 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
202 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
203 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
204 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
205 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
206 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
207 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
208 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
209 0x2e, 0x30, 0x2e, 0x31, 0x0a,
212 static object_data tag
= {
215 "09d373e1dfdc16b129ceec6dd649739911541e05",
218 "test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
223 /* zero == e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 */
224 static unsigned char zero_bytes
[] = {
225 0x30, 0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00,
229 static unsigned char zero_data
[] = {
230 0x00 /* dummy data */
233 static object_data zero
= {
236 "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
239 "test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
244 /* one == 8b137891791fe96927ad78e64b0aad7bded08bdc */
245 static unsigned char one_bytes
[] = {
246 0x31, 0x78, 0x9c, 0xe3, 0x02, 0x00, 0x00, 0x0b,
250 static unsigned char one_data
[] = {
254 static object_data one
= {
257 "8b137891791fe96927ad78e64b0aad7bded08bdc",
260 "test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
265 /* two == 78981922613b2afb6025042ff6bd878ac1994e85 */
266 static unsigned char two_bytes
[] = {
267 0x32, 0x78, 0x9c, 0x4b, 0xe4, 0x02, 0x00, 0x00,
271 static unsigned char two_data
[] = {
275 static object_data two
= {
278 "78981922613b2afb6025042ff6bd878ac1994e85",
281 "test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
286 /* some == fd8430bc864cfcd5f10e5590f8a447e01b942bfe */
287 static unsigned char some_bytes
[] = {
288 0xb1, 0x49, 0x78, 0x9c, 0x85, 0x53, 0xc1, 0x4e,
289 0xe3, 0x30, 0x10, 0xbd, 0xef, 0x57, 0xcc, 0x71,
290 0x17, 0x65, 0x81, 0xb2, 0xda, 0x53, 0x4f, 0x01,
291 0x51, 0x88, 0x04, 0x6d, 0x95, 0xa4, 0x42, 0x3d,
292 0xba, 0xf1, 0x84, 0x8c, 0x70, 0xec, 0xc8, 0x76,
293 0x28, 0xf9, 0xfb, 0x9d, 0x31, 0x2d, 0xb0, 0x5a,
294 0x56, 0x9c, 0xa2, 0xd8, 0xf3, 0xde, 0xbc, 0x79,
295 0xf3, 0x7c, 0x76, 0xf2, 0x0d, 0x4e, 0xa0, 0xee,
296 0x28, 0x40, 0x4b, 0x06, 0x41, 0xbe, 0x1e, 0x11,
297 0x82, 0x6b, 0xe3, 0x5e, 0x79, 0x9c, 0xc3, 0xe4,
298 0x46, 0x68, 0x94, 0x05, 0x8f, 0x9a, 0x42, 0xf4,
299 0xb4, 0x1b, 0x23, 0x97, 0x45, 0x50, 0x56, 0x9f,
300 0x39, 0x0f, 0xbd, 0xd3, 0xd4, 0x4e, 0x42, 0xc2,
301 0x67, 0xa3, 0xd5, 0xe8, 0x21, 0x76, 0x08, 0x11,
302 0x7d, 0x1f, 0xc0, 0xb5, 0xe9, 0xe7, 0x66, 0xb9,
303 0x81, 0x1b, 0xb4, 0xe8, 0x95, 0x81, 0xf5, 0xb8,
304 0x33, 0xd4, 0xc0, 0x1d, 0x35, 0x68, 0x03, 0x66,
305 0xf0, 0x8c, 0x3e, 0x90, 0xb3, 0x70, 0x91, 0x09,
306 0x87, 0x0a, 0x30, 0x48, 0x41, 0xe8, 0x50, 0xc3,
307 0x6e, 0x4a, 0xe8, 0x85, 0xe8, 0xa9, 0x0e, 0x7a,
308 0x60, 0xe1, 0xb8, 0x89, 0x8a, 0x0c, 0x39, 0x65,
309 0x80, 0x60, 0x0a, 0x0b, 0x4a, 0x6b, 0x92, 0x23,
310 0x88, 0x2e, 0x41, 0x06, 0xee, 0x4e, 0x41, 0x78,
311 0x03, 0x90, 0xfd, 0x4a, 0x83, 0x90, 0x48, 0x89,
312 0x1a, 0x63, 0xe7, 0x7c, 0x80, 0x47, 0x7a, 0xc6,
313 0x34, 0xf6, 0x68, 0x0d, 0xf5, 0x14, 0x59, 0xca,
314 0x3b, 0xa1, 0xb4, 0x30, 0x64, 0x9f, 0x12, 0xa2,
315 0x71, 0xfd, 0xc0, 0xae, 0x69, 0x61, 0x38, 0x0e,
316 0x92, 0x66, 0x7e, 0xb3, 0xd3, 0x72, 0x39, 0x57,
317 0xed, 0xc8, 0x26, 0xcd, 0x01, 0xf6, 0x14, 0x3b,
318 0x70, 0x0c, 0xf6, 0x30, 0x78, 0xf7, 0xe8, 0x55,
319 0x1f, 0x5e, 0x27, 0xb7, 0x5a, 0xa8, 0x3f, 0x78,
320 0xcc, 0x62, 0x02, 0xfe, 0x0b, 0x76, 0xa3, 0x78,
321 0x3f, 0xf1, 0x3e, 0xa4, 0xb2, 0x91, 0x0b, 0xc1,
322 0x73, 0x1d, 0xd9, 0x47, 0x5e, 0x9e, 0xeb, 0x93,
323 0xb4, 0x91, 0xb1, 0x1f, 0xa5, 0x9c, 0x02, 0x7c,
324 0xaf, 0xc5, 0x87, 0x4f, 0x3d, 0x10, 0x86, 0x0f,
325 0x84, 0x01, 0xb4, 0x03, 0x35, 0x0c, 0x66, 0x12,
326 0xfb, 0x5e, 0xd5, 0xf2, 0xf5, 0x80, 0x4d, 0x0c,
327 0x73, 0x68, 0x79, 0xed, 0xf8, 0xa2, 0xfa, 0xc1,
328 0xf0, 0xfe, 0xf8, 0x6e, 0xe2, 0xe6, 0x3c, 0xbd,
329 0x70, 0xa4, 0x34, 0x50, 0x93, 0xe4, 0x1e, 0xb7,
330 0x2f, 0xdd, 0xb3, 0x34, 0xdf, 0xdb, 0x70, 0x72,
331 0xbb, 0xef, 0xd0, 0x82, 0x75, 0x31, 0xb9, 0xc9,
332 0x16, 0x8b, 0x55, 0xc9, 0x88, 0xc3, 0xc8, 0x7c,
333 0x84, 0x2f, 0xd8, 0x8c, 0x51, 0xed, 0x58, 0xfd,
334 0x8f, 0xc3, 0xb2, 0xff, 0x4a, 0xea, 0xbb, 0x59,
335 0xfa, 0xb8, 0xe6, 0xce, 0x0d, 0xe2, 0x9c, 0x8a,
336 0x12, 0xc7, 0x3d, 0x19, 0x03, 0xbb, 0xe4, 0x45,
337 0x3b, 0x9a, 0x0c, 0xb8, 0x52, 0x38, 0x1e, 0x8a,
338 0xfa, 0x76, 0xb5, 0xa9, 0x21, 0x5f, 0x6e, 0xe1,
339 0x21, 0x2f, 0xcb, 0x7c, 0x59, 0x6f, 0xe7, 0x6f,
340 0xde, 0xe2, 0x33, 0xbe, 0x52, 0x11, 0x0f, 0x48,
341 0xcc, 0xcc, 0xb1, 0xf3, 0xca, 0xc6, 0x89, 0xe7,
342 0x11, 0xf4, 0xfd, 0x75, 0x79, 0x75, 0xcb, 0x90,
343 0xfc, 0xb2, 0xb8, 0x2b, 0xea, 0x2d, 0xb0, 0x19,
344 0x8b, 0xa2, 0x5e, 0x5e, 0x57, 0x15, 0x2c, 0x56,
345 0x25, 0xe4, 0xb0, 0xce, 0xcb, 0xba, 0xb8, 0xda,
346 0xdc, 0xe5, 0x25, 0xac, 0x37, 0xe5, 0x7a, 0x55,
347 0x5d, 0xb3, 0xf7, 0x15, 0xe2, 0x31, 0x86, 0x42,
348 0xf2, 0xf9, 0x16, 0x92, 0xb3, 0xbd, 0xe3, 0x94,
349 0x6b, 0x8c, 0x8a, 0x4c, 0x38, 0x46, 0x7c, 0xcb,
350 0x61, 0x0c, 0xac, 0xce, 0x68, 0xe8, 0x14, 0x87,
351 0xd3, 0x63, 0x83, 0x1c, 0x52, 0x9d, 0xcc, 0x1a,
352 0xa6, 0xaf, 0xdf, 0x59, 0x32, 0xd6, 0x38, 0x0e,
353 0x48, 0xca, 0x5f, 0x4a, 0xc5, 0x21, 0x7e, 0x73,
354 0x08, 0x07, 0x6d, 0xc9, 0xd6, 0xab, 0xd5, 0x7a,
355 0x5b, 0x2c, 0x6f, 0x58, 0x72, 0xd1, 0xca, 0x7a,
356 0x32, 0xd8, 0x7b, 0x92, 0x34, 0xba, 0xe3, 0x33,
357 0xf9, 0xdf, 0x7b, 0xcc, 0xe0, 0xf7, 0x8c, 0x2f,
358 0x95, 0x7d, 0xe2, 0x8d, 0x42, 0x15, 0xb9, 0x8c,
359 0xd1, 0x0b, 0x6a, 0xb9, 0xe1, 0xc2, 0x38, 0xe7,
360 0x53, 0xce, 0x2f, 0x5d, 0x88, 0x52, 0x7b, 0x9f,
361 0xc3, 0xf9, 0xc5, 0x6c, 0x76, 0xfe, 0x73, 0xf6,
362 0xeb, 0x7c, 0x96, 0xc1, 0xa6, 0xca, 0x65, 0xd8,
363 0xb3, 0x6f, 0x7f, 0x00, 0x5d, 0x59, 0x88, 0xc3,
366 static unsigned char some_data
[] = {
367 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
368 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
369 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
370 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
371 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
372 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
373 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
374 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
375 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
376 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
377 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
378 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
379 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
380 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
381 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
382 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
383 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
384 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
385 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
386 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
387 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
388 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
389 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
390 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
391 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
392 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
393 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
394 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
395 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
396 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
397 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
398 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
399 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
400 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
401 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
402 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
403 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
404 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
405 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
406 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
407 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
408 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
409 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
410 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
411 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
412 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
413 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
414 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
415 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
416 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
417 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
418 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
419 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
420 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
421 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
422 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
423 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
424 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
425 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
426 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
427 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
428 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
429 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
430 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
431 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
432 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
433 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
434 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
435 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
436 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
437 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
438 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
439 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
440 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
441 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
442 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
443 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
444 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
445 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
446 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
447 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
448 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
449 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
450 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
451 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
452 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
453 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
454 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
455 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
456 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
457 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
458 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
459 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
460 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
461 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
462 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
463 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
464 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
465 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
466 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
467 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
468 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
469 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
470 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
471 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
472 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
473 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
474 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
475 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
476 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
477 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
478 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
479 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
480 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
481 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
482 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
483 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
484 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
485 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
486 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
487 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
488 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
489 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
490 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
491 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
492 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
493 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
494 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
495 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
496 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
497 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
498 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
499 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
500 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
501 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
502 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
503 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
504 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
505 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
506 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
507 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
508 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
509 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
510 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
511 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
512 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
516 static object_data some
= {
519 "fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
522 "test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
527 BEGIN_TEST(read_loose_commit
)
532 must_pass(write_object_files(odb_dir
, &commit
));
533 must_pass(git_odb_open(&db
, odb_dir
));
534 must_pass(git_oid_mkstr(&id
, commit
.id
));
536 must_pass(git_odb__read_loose(&obj
, db
, &id
));
537 must_pass(cmp_objects(&obj
, &commit
));
541 must_pass(remove_object_files(odb_dir
, &commit
));
544 BEGIN_TEST(read_loose_tree
)
549 must_pass(write_object_files(odb_dir
, &tree
));
550 must_pass(git_odb_open(&db
, odb_dir
));
551 must_pass(git_oid_mkstr(&id
, tree
.id
));
553 must_pass(git_odb__read_loose(&obj
, db
, &id
));
554 must_pass(cmp_objects(&obj
, &tree
));
558 must_pass(remove_object_files(odb_dir
, &tree
));
561 BEGIN_TEST(read_loose_tag
)
566 must_pass(write_object_files(odb_dir
, &tag
));
567 must_pass(git_odb_open(&db
, odb_dir
));
568 must_pass(git_oid_mkstr(&id
, tag
.id
));
570 must_pass(git_odb__read_loose(&obj
, db
, &id
));
571 must_pass(cmp_objects(&obj
, &tag
));
575 must_pass(remove_object_files(odb_dir
, &tag
));
578 BEGIN_TEST(read_loose_zero
)
583 must_pass(write_object_files(odb_dir
, &zero
));
584 must_pass(git_odb_open(&db
, odb_dir
));
585 must_pass(git_oid_mkstr(&id
, zero
.id
));
587 must_pass(git_odb__read_loose(&obj
, db
, &id
));
588 must_pass(cmp_objects(&obj
, &zero
));
592 must_pass(remove_object_files(odb_dir
, &zero
));
595 BEGIN_TEST(read_loose_one
)
600 must_pass(write_object_files(odb_dir
, &one
));
601 must_pass(git_odb_open(&db
, odb_dir
));
602 must_pass(git_oid_mkstr(&id
, one
.id
));
604 must_pass(git_odb__read_loose(&obj
, db
, &id
));
605 must_pass(cmp_objects(&obj
, &one
));
609 must_pass(remove_object_files(odb_dir
, &one
));
612 BEGIN_TEST(read_loose_two
)
617 must_pass(write_object_files(odb_dir
, &two
));
618 must_pass(git_odb_open(&db
, odb_dir
));
619 must_pass(git_oid_mkstr(&id
, two
.id
));
621 must_pass(git_odb__read_loose(&obj
, db
, &id
));
622 must_pass(cmp_objects(&obj
, &two
));
626 must_pass(remove_object_files(odb_dir
, &two
));
629 BEGIN_TEST(read_loose_some
)
634 must_pass(write_object_files(odb_dir
, &some
));
635 must_pass(git_odb_open(&db
, odb_dir
));
636 must_pass(git_oid_mkstr(&id
, some
.id
));
638 must_pass(git_odb__read_loose(&obj
, db
, &id
));
639 must_pass(cmp_objects(&obj
, &some
));
643 must_pass(remove_object_files(odb_dir
, &some
));