diff options
author | Daniel Barkalow <barkalow@iabervon.org> | 2005-06-22 02:35:10 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-22 03:29:12 +0200 |
commit | 89e4202f9828c18f5db4db80a008a2a8a458855e (patch) | |
tree | 18d3bfddecf89de84930ddb66aedc37e9cbd56a7 /object.c | |
parent | Fix typo in git-checkout-script. (diff) | |
download | git-89e4202f9828c18f5db4db80a008a2a8a458855e.tar.xz git-89e4202f9828c18f5db4db80a008a2a8a458855e.zip |
[PATCH] Parse tags for absent objects
Handle parsing a tag for a non-present object. This adds a function to lookup
an object with lookup_* for * in a string, so that it can get the right storage
based on the "type" line in the tag.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -98,6 +98,22 @@ void mark_reachable(struct object *obj, unsigned int mask) } } +struct object *lookup_object_type(const unsigned char *sha1, const char *type) +{ + if (!strcmp(type, blob_type)) { + return &lookup_blob(sha1)->object; + } else if (!strcmp(type, tree_type)) { + return &lookup_tree(sha1)->object; + } else if (!strcmp(type, commit_type)) { + return &lookup_commit(sha1)->object; + } else if (!strcmp(type, tag_type)) { + return &lookup_tag(sha1)->object; + } else { + error("Unknown type %s", type); + return NULL; + } +} + struct object *parse_object(const unsigned char *sha1) { unsigned long mapsize; |