[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>
This commit is contained in:
Daniel Barkalow
2005-06-21 20:35:10 -04:00
committed by Linus Torvalds
parent 9661c25640
commit 89e4202f98
3 changed files with 27 additions and 4 deletions

View File

@ -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;