]> git.proxmox.com Git - libgit2.git/blob - tests/object/raw/write.c
9bc127680791530e88e4d957766aeb785d0b8917
[libgit2.git] / tests / object / raw / write.c
1 #include "clar_libgit2.h"
2 #include "git2/odb_backend.h"
3
4 #include "futils.h"
5 #include "odb.h"
6
7 typedef struct object_data {
8 char *id; /* object id (sha1) */
9 char *dir; /* object store (fan-out) directory name */
10 char *file; /* object store filename */
11 } object_data;
12
13 static const char *odb_dir = "test-objects";
14
15 void test_body(object_data *d, git_rawobj *o);
16
17
18
19 /* Helpers */
20 static void remove_object_files(object_data *d)
21 {
22 cl_git_pass(p_unlink(d->file));
23 cl_git_pass(p_rmdir(d->dir));
24 cl_assert(errno != ENOTEMPTY);
25 cl_git_pass(p_rmdir(odb_dir) < 0);
26 }
27
28 static void streaming_write(git_oid *oid, git_odb *odb, git_rawobj *raw)
29 {
30 git_odb_stream *stream;
31 int error;
32
33 cl_git_pass(git_odb_open_wstream(&stream, odb, raw->len, raw->type));
34 git_odb_stream_write(stream, raw->data, raw->len);
35 error = git_odb_stream_finalize_write(oid, stream);
36 git_odb_stream_free(stream);
37 cl_git_pass(error);
38 }
39
40 static void check_object_files(object_data *d)
41 {
42 cl_assert(git_path_exists(d->dir));
43 cl_assert(git_path_exists(d->file));
44 }
45
46 static void cmp_objects(git_rawobj *o1, git_rawobj *o2)
47 {
48 cl_assert(o1->type == o2->type);
49 cl_assert(o1->len == o2->len);
50 if (o1->len > 0)
51 cl_assert(memcmp(o1->data, o2->data, o1->len) == 0);
52 }
53
54 static void make_odb_dir(void)
55 {
56 cl_git_pass(p_mkdir(odb_dir, GIT_OBJECT_DIR_MODE));
57 }
58
59
60 /* Standard test form */
61 void test_body(object_data *d, git_rawobj *o)
62 {
63 git_odb *db;
64 git_oid id1, id2;
65 git_odb_object *obj;
66 git_rawobj tmp;
67
68 make_odb_dir();
69 cl_git_pass(git_odb_open(&db, odb_dir));
70 cl_git_pass(git_oid_fromstr(&id1, d->id));
71
72 streaming_write(&id2, db, o);
73 cl_assert(git_oid_cmp(&id1, &id2) == 0);
74 check_object_files(d);
75
76 cl_git_pass(git_odb_read(&obj, db, &id1));
77
78 tmp.data = obj->buffer;
79 tmp.len = obj->cached.size;
80 tmp.type = obj->cached.type;
81
82 cmp_objects(&tmp, o);
83
84 git_odb_object_free(obj);
85 git_odb_free(db);
86 remove_object_files(d);
87 }
88
89
90 void test_object_raw_write__loose_object(void)
91 {
92 object_data commit = {
93 "3d7f8a6af076c8c3f20071a8935cdbe8228594d1",
94 "test-objects/3d",
95 "test-objects/3d/7f8a6af076c8c3f20071a8935cdbe8228594d1",
96 };
97
98 unsigned char commit_data[] = {
99 0x74, 0x72, 0x65, 0x65, 0x20, 0x64, 0x66, 0x66,
100 0x32, 0x64, 0x61, 0x39, 0x30, 0x62, 0x32, 0x35,
101 0x34, 0x65, 0x31, 0x62, 0x65, 0x62, 0x38, 0x38,
102 0x39, 0x64, 0x31, 0x66, 0x31, 0x66, 0x31, 0x32,
103 0x38, 0x38, 0x62, 0x65, 0x31, 0x38, 0x30, 0x33,
104 0x37, 0x38, 0x32, 0x64, 0x66, 0x0a, 0x61, 0x75,
105 0x74, 0x68, 0x6f, 0x72, 0x20, 0x41, 0x20, 0x55,
106 0x20, 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61,
107 0x75, 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78,
108 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
109 0x6d, 0x3e, 0x20, 0x31, 0x32, 0x32, 0x37, 0x38,
110 0x31, 0x34, 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30,
111 0x30, 0x30, 0x30, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
112 0x69, 0x74, 0x74, 0x65, 0x72, 0x20, 0x43, 0x20,
113 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
114 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
115 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
116 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
117 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
118 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
119 0x30, 0x0a, 0x0a, 0x41, 0x20, 0x6f, 0x6e, 0x65,
120 0x2d, 0x6c, 0x69, 0x6e, 0x65, 0x20, 0x63, 0x6f,
121 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x73, 0x75, 0x6d,
122 0x6d, 0x61, 0x72, 0x79, 0x0a, 0x0a, 0x54, 0x68,
123 0x65, 0x20, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x6f,
124 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
125 0x6d, 0x6d, 0x69, 0x74, 0x20, 0x6d, 0x65, 0x73,
126 0x73, 0x61, 0x67, 0x65, 0x2c, 0x20, 0x63, 0x6f,
127 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67,
128 0x20, 0x66, 0x75, 0x72, 0x74, 0x68, 0x65, 0x72,
129 0x20, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61,
130 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x6f, 0x66, 0x20,
131 0x74, 0x68, 0x65, 0x20, 0x70, 0x75, 0x72, 0x70,
132 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74,
133 0x68, 0x65, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67,
134 0x65, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x72, 0x6f,
135 0x64, 0x75, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79,
136 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d,
137 0x6d, 0x69, 0x74, 0x2e, 0x0a, 0x0a, 0x53, 0x69,
138 0x67, 0x6e, 0x65, 0x64, 0x2d, 0x6f, 0x66, 0x2d,
139 0x62, 0x79, 0x3a, 0x20, 0x41, 0x20, 0x55, 0x20,
140 0x54, 0x68, 0x6f, 0x72, 0x20, 0x3c, 0x61, 0x75,
141 0x74, 0x68, 0x6f, 0x72, 0x40, 0x65, 0x78, 0x61,
142 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
143 0x3e, 0x0a,
144 };
145
146 git_rawobj commit_obj = {
147 commit_data,
148 sizeof(commit_data),
149 GIT_OBJECT_COMMIT
150 };
151
152 test_body(&commit, &commit_obj);
153 }
154
155 void test_object_raw_write__loose_tree(void)
156 {
157 static object_data tree = {
158 "dff2da90b254e1beb889d1f1f1288be1803782df",
159 "test-objects/df",
160 "test-objects/df/f2da90b254e1beb889d1f1f1288be1803782df",
161 };
162
163 static unsigned char tree_data[] = {
164 0x31, 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x6f,
165 0x6e, 0x65, 0x00, 0x8b, 0x13, 0x78, 0x91, 0x79,
166 0x1f, 0xe9, 0x69, 0x27, 0xad, 0x78, 0xe6, 0x4b,
167 0x0a, 0xad, 0x7b, 0xde, 0xd0, 0x8b, 0xdc, 0x31,
168 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x73, 0x6f,
169 0x6d, 0x65, 0x00, 0xfd, 0x84, 0x30, 0xbc, 0x86,
170 0x4c, 0xfc, 0xd5, 0xf1, 0x0e, 0x55, 0x90, 0xf8,
171 0xa4, 0x47, 0xe0, 0x1b, 0x94, 0x2b, 0xfe, 0x31,
172 0x30, 0x30, 0x36, 0x34, 0x34, 0x20, 0x74, 0x77,
173 0x6f, 0x00, 0x78, 0x98, 0x19, 0x22, 0x61, 0x3b,
174 0x2a, 0xfb, 0x60, 0x25, 0x04, 0x2f, 0xf6, 0xbd,
175 0x87, 0x8a, 0xc1, 0x99, 0x4e, 0x85, 0x31, 0x30,
176 0x30, 0x36, 0x34, 0x34, 0x20, 0x7a, 0x65, 0x72,
177 0x6f, 0x00, 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1,
178 0xd6, 0x43, 0x4b, 0x8b, 0x29, 0xae, 0x77, 0x5a,
179 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91,
180 };
181
182 static git_rawobj tree_obj = {
183 tree_data,
184 sizeof(tree_data),
185 GIT_OBJECT_TREE
186 };
187
188 test_body(&tree, &tree_obj);
189 }
190
191 void test_object_raw_write__loose_tag(void)
192 {
193 static object_data tag = {
194 "09d373e1dfdc16b129ceec6dd649739911541e05",
195 "test-objects/09",
196 "test-objects/09/d373e1dfdc16b129ceec6dd649739911541e05",
197 };
198
199 static unsigned char tag_data[] = {
200 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x33,
201 0x64, 0x37, 0x66, 0x38, 0x61, 0x36, 0x61, 0x66,
202 0x30, 0x37, 0x36, 0x63, 0x38, 0x63, 0x33, 0x66,
203 0x32, 0x30, 0x30, 0x37, 0x31, 0x61, 0x38, 0x39,
204 0x33, 0x35, 0x63, 0x64, 0x62, 0x65, 0x38, 0x32,
205 0x32, 0x38, 0x35, 0x39, 0x34, 0x64, 0x31, 0x0a,
206 0x74, 0x79, 0x70, 0x65, 0x20, 0x63, 0x6f, 0x6d,
207 0x6d, 0x69, 0x74, 0x0a, 0x74, 0x61, 0x67, 0x20,
208 0x76, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x0a, 0x74,
209 0x61, 0x67, 0x67, 0x65, 0x72, 0x20, 0x43, 0x20,
210 0x4f, 0x20, 0x4d, 0x69, 0x74, 0x74, 0x65, 0x72,
211 0x20, 0x3c, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74,
212 0x74, 0x65, 0x72, 0x40, 0x65, 0x78, 0x61, 0x6d,
213 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x3e,
214 0x20, 0x31, 0x32, 0x32, 0x37, 0x38, 0x31, 0x34,
215 0x32, 0x39, 0x37, 0x20, 0x2b, 0x30, 0x30, 0x30,
216 0x30, 0x0a, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20,
217 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
218 0x61, 0x67, 0x20, 0x6f, 0x62, 0x6a, 0x65, 0x63,
219 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65,
220 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x76, 0x30,
221 0x2e, 0x30, 0x2e, 0x31, 0x0a,
222 };
223
224 static git_rawobj tag_obj = {
225 tag_data,
226 sizeof(tag_data),
227 GIT_OBJECT_TAG
228 };
229
230
231 test_body(&tag, &tag_obj);
232 }
233
234 void test_object_raw_write__zero_length(void)
235 {
236 static object_data zero = {
237 "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
238 "test-objects/e6",
239 "test-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391",
240 };
241
242 static unsigned char zero_data[] = {
243 0x00 /* dummy data */
244 };
245
246 static git_rawobj zero_obj = {
247 zero_data,
248 0,
249 GIT_OBJECT_BLOB
250 };
251
252 test_body(&zero, &zero_obj);
253 }
254
255 void test_object_raw_write__one_byte(void)
256 {
257 static object_data one = {
258 "8b137891791fe96927ad78e64b0aad7bded08bdc",
259 "test-objects/8b",
260 "test-objects/8b/137891791fe96927ad78e64b0aad7bded08bdc",
261 };
262
263 static unsigned char one_data[] = {
264 0x0a,
265 };
266
267 static git_rawobj one_obj = {
268 one_data,
269 sizeof(one_data),
270 GIT_OBJECT_BLOB
271 };
272
273 test_body(&one, &one_obj);
274 }
275
276 void test_object_raw_write__two_byte(void)
277 {
278 static object_data two = {
279 "78981922613b2afb6025042ff6bd878ac1994e85",
280 "test-objects/78",
281 "test-objects/78/981922613b2afb6025042ff6bd878ac1994e85",
282 };
283
284 static unsigned char two_data[] = {
285 0x61, 0x0a,
286 };
287
288 static git_rawobj two_obj = {
289 two_data,
290 sizeof(two_data),
291 GIT_OBJECT_BLOB
292 };
293
294 test_body(&two, &two_obj);
295 }
296
297 void test_object_raw_write__several_bytes(void)
298 {
299 static object_data some = {
300 "fd8430bc864cfcd5f10e5590f8a447e01b942bfe",
301 "test-objects/fd",
302 "test-objects/fd/8430bc864cfcd5f10e5590f8a447e01b942bfe",
303 };
304
305 static unsigned char some_data[] = {
306 0x2f, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x54, 0x68,
307 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20,
308 0x69, 0x73, 0x20, 0x66, 0x72, 0x65, 0x65, 0x20,
309 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
310 0x3b, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61,
311 0x6e, 0x20, 0x72, 0x65, 0x64, 0x69, 0x73, 0x74,
312 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x69,
313 0x74, 0x20, 0x61, 0x6e, 0x64, 0x2f, 0x6f, 0x72,
314 0x20, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x0a,
315 0x20, 0x2a, 0x20, 0x69, 0x74, 0x20, 0x75, 0x6e,
316 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20,
317 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
318 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
319 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
320 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
321 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x2c,
322 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
323 0x20, 0x32, 0x2c, 0x0a, 0x20, 0x2a, 0x20, 0x61,
324 0x73, 0x20, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73,
325 0x68, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74,
326 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
327 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
328 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
329 0x69, 0x6f, 0x6e, 0x2e, 0x0a, 0x20, 0x2a, 0x0a,
330 0x20, 0x2a, 0x20, 0x49, 0x6e, 0x20, 0x61, 0x64,
331 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74,
332 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x65,
333 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
334 0x73, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65,
335 0x20, 0x47, 0x4e, 0x55, 0x20, 0x47, 0x65, 0x6e,
336 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50, 0x75, 0x62,
337 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69, 0x63, 0x65,
338 0x6e, 0x73, 0x65, 0x2c, 0x0a, 0x20, 0x2a, 0x20,
339 0x74, 0x68, 0x65, 0x20, 0x61, 0x75, 0x74, 0x68,
340 0x6f, 0x72, 0x73, 0x20, 0x67, 0x69, 0x76, 0x65,
341 0x20, 0x79, 0x6f, 0x75, 0x20, 0x75, 0x6e, 0x6c,
342 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x20, 0x70,
343 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
344 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x6c, 0x69, 0x6e,
345 0x6b, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f,
346 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x64, 0x0a, 0x20,
347 0x2a, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
348 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x69,
349 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x69,
350 0x6e, 0x74, 0x6f, 0x20, 0x63, 0x6f, 0x6d, 0x62,
351 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
352 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6f, 0x74,
353 0x68, 0x65, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x67,
354 0x72, 0x61, 0x6d, 0x73, 0x2c, 0x0a, 0x20, 0x2a,
355 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20,
356 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
357 0x74, 0x65, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65,
358 0x20, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61,
359 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x77, 0x69,
360 0x74, 0x68, 0x6f, 0x75, 0x74, 0x20, 0x61, 0x6e,
361 0x79, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69,
362 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x2a,
363 0x20, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x20,
364 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65,
365 0x20, 0x75, 0x73, 0x65, 0x20, 0x6f, 0x66, 0x20,
366 0x74, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
367 0x65, 0x2e, 0x20, 0x20, 0x28, 0x54, 0x68, 0x65,
368 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
369 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
370 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
371 0x20, 0x2a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x72,
372 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
373 0x64, 0x6f, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x79,
374 0x20, 0x69, 0x6e, 0x20, 0x6f, 0x74, 0x68, 0x65,
375 0x72, 0x20, 0x72, 0x65, 0x73, 0x70, 0x65, 0x63,
376 0x74, 0x73, 0x3b, 0x20, 0x66, 0x6f, 0x72, 0x20,
377 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c,
378 0x20, 0x74, 0x68, 0x65, 0x79, 0x20, 0x63, 0x6f,
379 0x76, 0x65, 0x72, 0x0a, 0x20, 0x2a, 0x20, 0x6d,
380 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
381 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74,
382 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x2c,
383 0x20, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x69, 0x73,
384 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f,
385 0x6e, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6e,
386 0x6f, 0x74, 0x20, 0x6c, 0x69, 0x6e, 0x6b, 0x65,
387 0x64, 0x20, 0x69, 0x6e, 0x74, 0x6f, 0x0a, 0x20,
388 0x2a, 0x20, 0x61, 0x20, 0x63, 0x6f, 0x6d, 0x62,
389 0x69, 0x6e, 0x65, 0x64, 0x20, 0x65, 0x78, 0x65,
390 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x2e,
391 0x29, 0x0a, 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20,
392 0x54, 0x68, 0x69, 0x73, 0x20, 0x66, 0x69, 0x6c,
393 0x65, 0x20, 0x69, 0x73, 0x20, 0x64, 0x69, 0x73,
394 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
395 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20,
396 0x68, 0x6f, 0x70, 0x65, 0x20, 0x74, 0x68, 0x61,
397 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, 0x6c,
398 0x6c, 0x20, 0x62, 0x65, 0x20, 0x75, 0x73, 0x65,
399 0x66, 0x75, 0x6c, 0x2c, 0x20, 0x62, 0x75, 0x74,
400 0x0a, 0x20, 0x2a, 0x20, 0x57, 0x49, 0x54, 0x48,
401 0x4f, 0x55, 0x54, 0x20, 0x41, 0x4e, 0x59, 0x20,
402 0x57, 0x41, 0x52, 0x52, 0x41, 0x4e, 0x54, 0x59,
403 0x3b, 0x20, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75,
404 0x74, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x20, 0x74,
405 0x68, 0x65, 0x20, 0x69, 0x6d, 0x70, 0x6c, 0x69,
406 0x65, 0x64, 0x20, 0x77, 0x61, 0x72, 0x72, 0x61,
407 0x6e, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x0a, 0x20,
408 0x2a, 0x20, 0x4d, 0x45, 0x52, 0x43, 0x48, 0x41,
409 0x4e, 0x54, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
410 0x59, 0x20, 0x6f, 0x72, 0x20, 0x46, 0x49, 0x54,
411 0x4e, 0x45, 0x53, 0x53, 0x20, 0x46, 0x4f, 0x52,
412 0x20, 0x41, 0x20, 0x50, 0x41, 0x52, 0x54, 0x49,
413 0x43, 0x55, 0x4c, 0x41, 0x52, 0x20, 0x50, 0x55,
414 0x52, 0x50, 0x4f, 0x53, 0x45, 0x2e, 0x20, 0x20,
415 0x53, 0x65, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20,
416 0x47, 0x4e, 0x55, 0x0a, 0x20, 0x2a, 0x20, 0x47,
417 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x20, 0x50,
418 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x4c, 0x69,
419 0x63, 0x65, 0x6e, 0x73, 0x65, 0x20, 0x66, 0x6f,
420 0x72, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x64,
421 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2e, 0x0a,
422 0x20, 0x2a, 0x0a, 0x20, 0x2a, 0x20, 0x59, 0x6f,
423 0x75, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64,
424 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x72, 0x65,
425 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x20, 0x61,
426 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x6f, 0x66,
427 0x20, 0x74, 0x68, 0x65, 0x20, 0x47, 0x4e, 0x55,
428 0x20, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
429 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
430 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x0a,
431 0x20, 0x2a, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
432 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x74, 0x68,
433 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
434 0x61, 0x6d, 0x3b, 0x20, 0x73, 0x65, 0x65, 0x20,
435 0x74, 0x68, 0x65, 0x20, 0x66, 0x69, 0x6c, 0x65,
436 0x20, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47,
437 0x2e, 0x20, 0x20, 0x49, 0x66, 0x20, 0x6e, 0x6f,
438 0x74, 0x2c, 0x20, 0x77, 0x72, 0x69, 0x74, 0x65,
439 0x20, 0x74, 0x6f, 0x0a, 0x20, 0x2a, 0x20, 0x74,
440 0x68, 0x65, 0x20, 0x46, 0x72, 0x65, 0x65, 0x20,
441 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65,
442 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74,
443 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x35, 0x31, 0x20,
444 0x46, 0x72, 0x61, 0x6e, 0x6b, 0x6c, 0x69, 0x6e,
445 0x20, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x2c,
446 0x20, 0x46, 0x69, 0x66, 0x74, 0x68, 0x20, 0x46,
447 0x6c, 0x6f, 0x6f, 0x72, 0x2c, 0x0a, 0x20, 0x2a,
448 0x20, 0x42, 0x6f, 0x73, 0x74, 0x6f, 0x6e, 0x2c,
449 0x20, 0x4d, 0x41, 0x20, 0x30, 0x32, 0x31, 0x31,
450 0x30, 0x2d, 0x31, 0x33, 0x30, 0x31, 0x2c, 0x20,
451 0x55, 0x53, 0x41, 0x2e, 0x0a, 0x20, 0x2a, 0x2f,
452 0x0a,
453 };
454
455 static git_rawobj some_obj = {
456 some_data,
457 sizeof(some_data),
458 GIT_OBJECT_BLOB
459 };
460
461 test_body(&some, &some_obj);
462 }