author | Lars Hjemli <hjemli@gmail.com> | 2007-02-04 21:55:19 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-02-04 21:55:19 (UTC) |
commit | 8fb2f056961e577a039ae185d89ab8e2d2840b9e (patch) (unidiff) | |
tree | a009aca3c52dd134faa48181daede79bd930f9a4 /git.h | |
parent | ce1c7336e5b3e3ebe8f8c9029c405aedec98c208 (diff) | |
download | cgit-8fb2f056961e577a039ae185d89ab8e2d2840b9e.zip cgit-8fb2f056961e577a039ae185d89ab8e2d2840b9e.tar.gz cgit-8fb2f056961e577a039ae185d89ab8e2d2840b9e.tar.bz2 |
Add support for lightweight tags
There is nothing bad about a tag that has no tag-object, but the old code
didn't handle such tags correctly. Fix it.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | git.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -233,96 +233,100 @@ struct grep_opt { | |||
233 | }; | 233 | }; |
234 | 234 | ||
235 | 235 | ||
236 | extern void compile_grep_patterns(struct grep_opt *opt); | 236 | extern void compile_grep_patterns(struct grep_opt *opt); |
237 | extern void free_grep_patterns(struct grep_opt *opt); | 237 | extern void free_grep_patterns(struct grep_opt *opt); |
238 | 238 | ||
239 | 239 | ||
240 | /* | 240 | /* |
241 | * from git:object.h | 241 | * from git:object.h |
242 | */ | 242 | */ |
243 | 243 | ||
244 | extern const char *type_names[9]; | 244 | extern const char *type_names[9]; |
245 | 245 | ||
246 | struct object_list { | 246 | struct object_list { |
247 | struct object *item; | 247 | struct object *item; |
248 | struct object_list *next; | 248 | struct object_list *next; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | struct object_refs { | 251 | struct object_refs { |
252 | unsigned count; | 252 | unsigned count; |
253 | struct object *base; | 253 | struct object *base; |
254 | struct object *ref[FLEX_ARRAY]; /* more */ | 254 | struct object *ref[FLEX_ARRAY]; /* more */ |
255 | }; | 255 | }; |
256 | 256 | ||
257 | struct object_array { | 257 | struct object_array { |
258 | unsigned int nr; | 258 | unsigned int nr; |
259 | unsigned int alloc; | 259 | unsigned int alloc; |
260 | struct object_array_entry { | 260 | struct object_array_entry { |
261 | struct object *item; | 261 | struct object *item; |
262 | const char *name; | 262 | const char *name; |
263 | } *objects; | 263 | } *objects; |
264 | }; | 264 | }; |
265 | 265 | ||
266 | #define TYPE_BITS 3 | 266 | #define TYPE_BITS 3 |
267 | #define FLAG_BITS 27 | 267 | #define FLAG_BITS 27 |
268 | 268 | ||
269 | /* | 269 | /* |
270 | * The object type is stored in 3 bits. | 270 | * The object type is stored in 3 bits. |
271 | */ | 271 | */ |
272 | struct object { | 272 | struct object { |
273 | unsigned parsed : 1; | 273 | unsigned parsed : 1; |
274 | unsigned used : 1; | 274 | unsigned used : 1; |
275 | unsigned type : TYPE_BITS; | 275 | unsigned type : TYPE_BITS; |
276 | unsigned flags : FLAG_BITS; | 276 | unsigned flags : FLAG_BITS; |
277 | unsigned char sha1[20]; | 277 | unsigned char sha1[20]; |
278 | }; | 278 | }; |
279 | 279 | ||
280 | 280 | ||
281 | /** Returns the object, having parsed it to find out what it is. **/ | ||
282 | struct object *parse_object(const unsigned char *sha1); | ||
283 | |||
284 | |||
281 | /* | 285 | /* |
282 | * from git:tree.h | 286 | * from git:tree.h |
283 | */ | 287 | */ |
284 | 288 | ||
285 | struct tree { | 289 | struct tree { |
286 | struct object object; | 290 | struct object object; |
287 | void *buffer; | 291 | void *buffer; |
288 | unsigned long size; | 292 | unsigned long size; |
289 | }; | 293 | }; |
290 | 294 | ||
291 | 295 | ||
292 | struct tree *lookup_tree(const unsigned char *sha1); | 296 | struct tree *lookup_tree(const unsigned char *sha1); |
293 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); | 297 | int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size); |
294 | int parse_tree(struct tree *tree); | 298 | int parse_tree(struct tree *tree); |
295 | struct tree *parse_tree_indirect(const unsigned char *sha1); | 299 | struct tree *parse_tree_indirect(const unsigned char *sha1); |
296 | 300 | ||
297 | typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int); | 301 | typedef int (*read_tree_fn_t)(const unsigned char *, const char *, int, const char *, unsigned int, int); |
298 | 302 | ||
299 | extern int read_tree_recursive(struct tree *tree, | 303 | extern int read_tree_recursive(struct tree *tree, |
300 | const char *base, int baselen, | 304 | const char *base, int baselen, |
301 | int stage, const char **match, | 305 | int stage, const char **match, |
302 | read_tree_fn_t fn); | 306 | read_tree_fn_t fn); |
303 | 307 | ||
304 | extern int read_tree(struct tree *tree, int stage, const char **paths); | 308 | extern int read_tree(struct tree *tree, int stage, const char **paths); |
305 | 309 | ||
306 | 310 | ||
307 | /* from git:commit.h */ | 311 | /* from git:commit.h */ |
308 | 312 | ||
309 | struct commit_list { | 313 | struct commit_list { |
310 | struct commit *item; | 314 | struct commit *item; |
311 | struct commit_list *next; | 315 | struct commit_list *next; |
312 | }; | 316 | }; |
313 | 317 | ||
314 | struct commit { | 318 | struct commit { |
315 | struct object object; | 319 | struct object object; |
316 | void *util; | 320 | void *util; |
317 | unsigned long date; | 321 | unsigned long date; |
318 | struct commit_list *parents; | 322 | struct commit_list *parents; |
319 | struct tree *tree; | 323 | struct tree *tree; |
320 | char *buffer; | 324 | char *buffer; |
321 | }; | 325 | }; |
322 | 326 | ||
323 | 327 | ||
324 | struct commit *lookup_commit(const unsigned char *sha1); | 328 | struct commit *lookup_commit(const unsigned char *sha1); |
325 | struct commit *lookup_commit_reference(const unsigned char *sha1); | 329 | struct commit *lookup_commit_reference(const unsigned char *sha1); |
326 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, | 330 | struct commit *lookup_commit_reference_gently(const unsigned char *sha1, |
327 | int quiet); | 331 | int quiet); |
328 | 332 | ||