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>
brian m. carlson committed
May 6, 2017 at 22:10 UTC
d3101b533d365825f52d8e5e52328702acbc8e3a
8 files changed
+13
-13
builtin/describe.c
+3
-3
@@ -79,13 +79,13 @@ static int replace_name(struct commit_name *e,
79
struct tag *t;
80
81
if (!e->tag) {
82
- t = lookup_tag(e->oid.hash);
82
+ t = lookup_tag(&e->oid);
83
if (!t || parse_tag(t))
84
return 1;
85
e->tag = t;
86
}
87
88
- t = lookup_tag(oid->hash);
88
+ t = lookup_tag(oid);
89
if (!t || parse_tag(t))
90
return 0;
91
*tag = t;
@@ -245,7 +245,7 @@ static unsigned long finish_depth_computation(
245
static void display_name(struct commit_name *n)
246
{
247
if (n->prio == 2 && !n->tag) {
248
- n->tag = lookup_tag(n->oid.hash);
248
+ n->tag = lookup_tag(&n->oid);
249
if (!n->tag || parse_tag(n->tag))
250
die(_("annotated tag %s not available"), n->path);
251
}
builtin/pack-objects.c
+1
-1
@@ -2348,7 +2348,7 @@ static void add_tag_chain(const struct object_id *oid)
2348
if (packlist_find(&to_pack, oid->hash, NULL))
2349
return;
2350
2351
- tag = lookup_tag(oid->hash);
2351
+ tag = lookup_tag(oid);
2352
while (1) {
2353
if (!tag || parse_tag(tag) || !tag->tagged)
2354
die("unable to pack objects reachable from tag %s",
builtin/replace.c
+1
-1
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
355
int i;
356
357
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), tag_oid.hash);
358
- tag = lookup_tag(tag_oid.hash);
358
+ tag = lookup_tag(&tag_oid);
359
if (!tag)
360
die(_("bad mergetag in commit '%s'"), ref);
361
if (parse_tag_buffer(tag, extra->value, extra->len))
log-tree.c
+1
-1
@@ -488,7 +488,7 @@ static void show_one_mergetag(struct commit *commit,
488
size_t payload_size, gpg_message_offset;
489
490
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
491
- tag = lookup_tag(oid.hash);
491
+ tag = lookup_tag(&oid);
492
if (!tag)
493
return; /* error message already given */
494
object.c
+1
-1
@@ -220,7 +220,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
220
obj = &commit->object;
221
}
222
} else if (type == OBJ_TAG) {
223
- struct tag *tag = lookup_tag(sha1);
223
+ struct tag *tag = lookup_tag(&oid);
224
if (tag) {
225
if (parse_tag_buffer(tag, buffer, size))
226
return NULL;
sha1_name.c
+1
-1
@@ -361,7 +361,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
361
format_commit_message(commit, " %ad - %s", &desc, &pp);
362
}
363
} else if (type == OBJ_TAG) {
364
- struct tag *tag = lookup_tag(oid->hash);
364
+ struct tag *tag = lookup_tag(oid);
365
if (!parse_tag(tag) && tag->tag)
366
strbuf_addf(&desc, " %s", tag->tag);
367
}
tag.c
+4
-4
@@ -89,11 +89,11 @@ struct object *deref_tag_noverify(struct object *o)
89
return o;
90
}
91
92
-struct tag *lookup_tag(const unsigned char *sha1)
92
+struct tag *lookup_tag(const struct object_id *oid)
93
{
94
- struct object *obj = lookup_object(sha1);
94
+ struct object *obj = lookup_object(oid->hash);
95
if (!obj)
96
- return create_object(sha1, alloc_tag_node());
96
+ return create_object(oid->hash, alloc_tag_node());
97
return object_as_type(obj, OBJ_TAG, 0);
98
}
99
@@ -148,7 +148,7 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
148
} else if (!strcmp(type, commit_type)) {
149
item->tagged = &lookup_commit(&oid)->object;
150
} else if (!strcmp(type, tag_type)) {
151
- item->tagged = &lookup_tag(oid.hash)->object;
151
+ item->tagged = &lookup_tag(&oid)->object;
152
} else {
153
error("Unknown type %s", type);
154
item->tagged = NULL;
tag.h
+1
-1
@@ -12,7 +12,7 @@ struct tag {
12
unsigned long date;
13
};
14
15
-extern struct tag *lookup_tag(const unsigned char *sha1);
15
+extern struct tag *lookup_tag(const struct object_id *oid);
16
extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long size);
17
extern int parse_tag(struct tag *item);
18
extern struct object *deref_tag(struct object *, const char *, int);