1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-12 01:16:09 +02:00

Convert lookup_tag to struct object_id

Convert lookup_tag to take a pointer to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2017-05-06 22:10:19 +00:00 committed by Junio C Hamano
parent a92ea68fef
commit d3101b533d
8 changed files with 13 additions and 13 deletions

View File

@ -79,13 +79,13 @@ static int replace_name(struct commit_name *e,
struct tag *t;
if (!e->tag) {
t = lookup_tag(e->oid.hash);
t = lookup_tag(&e->oid);
if (!t || parse_tag(t))
return 1;
e->tag = t;
}
t = lookup_tag(oid->hash);
t = lookup_tag(oid);
if (!t || parse_tag(t))
return 0;
*tag = t;
@ -245,7 +245,7 @@ static unsigned long finish_depth_computation(
static void display_name(struct commit_name *n)
{
if (n->prio == 2 && !n->tag) {
n->tag = lookup_tag(n->oid.hash);
n->tag = lookup_tag(&n->oid);
if (!n->tag || parse_tag(n->tag))
die(_("annotated tag %s not available"), n->path);
}

View File

@ -2348,7 +2348,7 @@ static void add_tag_chain(const struct object_id *oid)
if (packlist_find(&to_pack, oid->hash, NULL))
return;
tag = lookup_tag(oid->hash);
tag = lookup_tag(oid);
while (1) {
if (!tag || parse_tag(tag) || !tag->tagged)
die("unable to pack objects reachable from tag %s",

View File

@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
int i;
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
tag = lookup_tag(tag_oid.hash);
tag = lookup_tag(&tag_oid);
if (!tag)
die(_("bad mergetag in commit '%s'"), ref);
if (parse_tag_buffer(tag, extra->value, extra->len))

View File

@ -488,7 +488,7 @@ static void show_one_mergetag(struct commit *commit,
size_t payload_size, gpg_message_offset;
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
tag = lookup_tag(oid.hash);
tag = lookup_tag(&oid);
if (!tag)
return; /* error message already given */

View File

@ -220,7 +220,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
obj = &commit->object;
}
} else if (type == OBJ_TAG) {
struct tag *tag = lookup_tag(sha1);
struct tag *tag = lookup_tag(&oid);
if (tag) {
if (parse_tag_buffer(tag, buffer, size))
return NULL;

View File

@ -361,7 +361,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
format_commit_message(commit, " %ad - %s", &desc, &pp);
}
} else if (type == OBJ_TAG) {
struct tag *tag = lookup_tag(oid->hash);
struct tag *tag = lookup_tag(oid);
if (!parse_tag(tag) && tag->tag)
strbuf_addf(&desc, " %s", tag->tag);
}

8
tag.c
View File

@ -89,11 +89,11 @@ struct object *deref_tag_noverify(struct object *o)
return o;
}
struct tag *lookup_tag(const unsigned char *sha1)
struct tag *lookup_tag(const struct object_id *oid)
{
struct object *obj = lookup_object(sha1);
struct object *obj = lookup_object(oid->hash);
if (!obj)
return create_object(sha1, alloc_tag_node());
return create_object(oid->hash, alloc_tag_node());
return object_as_type(obj, OBJ_TAG, 0);
}
@ -148,7 +148,7 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
} else if (!strcmp(type, commit_type)) {
item->tagged = &lookup_commit(&oid)->object;
} else if (!strcmp(type, tag_type)) {
item->tagged = &lookup_tag(oid.hash)->object;
item->tagged = &lookup_tag(&oid)->object;
} else {
error("Unknown type %s", type);
item->tagged = NULL;

2
tag.h
View File

@ -12,7 +12,7 @@ struct tag {
unsigned long date;
};
extern struct tag *lookup_tag(const unsigned char *sha1);
extern struct tag *lookup_tag(const struct object_id *oid);
extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long size);
extern int parse_tag(struct tag *item);
extern struct object *deref_tag(struct object *, const char *, int);