Skip to content

Commit d3101b5

Browse files
bk2204gitster
authored andcommitted
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>
1 parent a92ea68 commit d3101b5

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

builtin/describe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ static int replace_name(struct commit_name *e,
7979
struct tag *t;
8080

8181
if (!e->tag) {
82-
t = lookup_tag(e->oid.hash);
82+
t = lookup_tag(&e->oid);
8383
if (!t || parse_tag(t))
8484
return 1;
8585
e->tag = t;
8686
}
8787

88-
t = lookup_tag(oid->hash);
88+
t = lookup_tag(oid);
8989
if (!t || parse_tag(t))
9090
return 0;
9191
*tag = t;
@@ -245,7 +245,7 @@ static unsigned long finish_depth_computation(
245245
static void display_name(struct commit_name *n)
246246
{
247247
if (n->prio == 2 && !n->tag) {
248-
n->tag = lookup_tag(n->oid.hash);
248+
n->tag = lookup_tag(&n->oid);
249249
if (!n->tag || parse_tag(n->tag))
250250
die(_("annotated tag %s not available"), n->path);
251251
}

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,7 @@ static void add_tag_chain(const struct object_id *oid)
23482348
if (packlist_find(&to_pack, oid->hash, NULL))
23492349
return;
23502350

2351-
tag = lookup_tag(oid->hash);
2351+
tag = lookup_tag(oid);
23522352
while (1) {
23532353
if (!tag || parse_tag(tag) || !tag->tagged)
23542354
die("unable to pack objects reachable from tag %s",

builtin/replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static void check_one_mergetag(struct commit *commit,
355355
int i;
356356

357357
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);
359359
if (!tag)
360360
die(_("bad mergetag in commit '%s'"), ref);
361361
if (parse_tag_buffer(tag, extra->value, extra->len))

log-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static void show_one_mergetag(struct commit *commit,
488488
size_t payload_size, gpg_message_offset;
489489

490490
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
491-
tag = lookup_tag(oid.hash);
491+
tag = lookup_tag(&oid);
492492
if (!tag)
493493
return; /* error message already given */
494494

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
220220
obj = &commit->object;
221221
}
222222
} else if (type == OBJ_TAG) {
223-
struct tag *tag = lookup_tag(sha1);
223+
struct tag *tag = lookup_tag(&oid);
224224
if (tag) {
225225
if (parse_tag_buffer(tag, buffer, size))
226226
return NULL;

sha1_name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
361361
format_commit_message(commit, " %ad - %s", &desc, &pp);
362362
}
363363
} else if (type == OBJ_TAG) {
364-
struct tag *tag = lookup_tag(oid->hash);
364+
struct tag *tag = lookup_tag(oid);
365365
if (!parse_tag(tag) && tag->tag)
366366
strbuf_addf(&desc, " %s", tag->tag);
367367
}

tag.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ struct object *deref_tag_noverify(struct object *o)
8989
return o;
9090
}
9191

92-
struct tag *lookup_tag(const unsigned char *sha1)
92+
struct tag *lookup_tag(const struct object_id *oid)
9393
{
94-
struct object *obj = lookup_object(sha1);
94+
struct object *obj = lookup_object(oid->hash);
9595
if (!obj)
96-
return create_object(sha1, alloc_tag_node());
96+
return create_object(oid->hash, alloc_tag_node());
9797
return object_as_type(obj, OBJ_TAG, 0);
9898
}
9999

@@ -148,7 +148,7 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
148148
} else if (!strcmp(type, commit_type)) {
149149
item->tagged = &lookup_commit(&oid)->object;
150150
} else if (!strcmp(type, tag_type)) {
151-
item->tagged = &lookup_tag(oid.hash)->object;
151+
item->tagged = &lookup_tag(&oid)->object;
152152
} else {
153153
error("Unknown type %s", type);
154154
item->tagged = NULL;

tag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct tag {
1212
unsigned long date;
1313
};
1414

15-
extern struct tag *lookup_tag(const unsigned char *sha1);
15+
extern struct tag *lookup_tag(const struct object_id *oid);
1616
extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long size);
1717
extern int parse_tag(struct tag *item);
1818
extern struct object *deref_tag(struct object *, const char *, int);

0 commit comments

Comments
 (0)