Skip to content

Commit 0e740fe

Browse files
stefanbellergitster
authored andcommitted
tag: add repository argument to parse_tag_buffer
Add a repository argument to allow the callers of parse_tag_buffer to be more specific about which repository to act on. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet. As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ce71efb commit 0e740fe

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

builtin/replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int check_one_mergetag(struct commit *commit,
405405
tag = lookup_tag(the_repository, &tag_oid);
406406
if (!tag)
407407
return error(_("bad mergetag in commit '%s'"), ref);
408-
if (parse_tag_buffer(tag, extra->value, extra->len))
408+
if (parse_tag_buffer(the_repository, tag, extra->value, extra->len))
409409
return error(_("malformed mergetag in commit '%s'"), ref);
410410

411411
/* iterate over new parents */

log-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int show_one_mergetag(struct commit *commit,
503503
return -1; /* error message already given */
504504

505505
strbuf_init(&verify_message, 256);
506-
if (parse_tag_buffer(tag, extra->value, extra->len))
506+
if (parse_tag_buffer(the_repository, tag, extra->value, extra->len))
507507
strbuf_addstr(&verify_message, "malformed mergetag\n");
508508
else if (is_common_merge(commit) &&
509509
!oidcmp(&tag->tagged->oid,

object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct object *parse_object_buffer_the_repository(const struct object_id *oid, e
225225
} else if (type == OBJ_TAG) {
226226
struct tag *tag = lookup_tag(the_repository, oid);
227227
if (tag) {
228-
if (parse_tag_buffer(tag, buffer, size))
228+
if (parse_tag_buffer(the_repository, tag, buffer, size))
229229
return NULL;
230230
obj = &tag->object;
231231
}

sha1-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ static void check_tag(const void *buf, size_t size)
18091809
{
18101810
struct tag t;
18111811
memset(&t, 0, sizeof(t));
1812-
if (parse_tag_buffer(&t, buf, size))
1812+
if (parse_tag_buffer(the_repository, &t, buf, size))
18131813
die("corrupt tag");
18141814
}
18151815

tag.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void release_tag_memory(struct tag *t)
126126
t->date = 0;
127127
}
128128

129-
int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
129+
int parse_tag_buffer_the_repository(struct tag *item, const void *data, unsigned long size)
130130
{
131131
struct object_id oid;
132132
char type[20];
@@ -203,7 +203,7 @@ int parse_tag(struct tag *item)
203203
return error("Object %s not a tag",
204204
oid_to_hex(&item->object.oid));
205205
}
206-
ret = parse_tag_buffer(item, data, size);
206+
ret = parse_tag_buffer(the_repository, item, data, size);
207207
free(data);
208208
return ret;
209209
}

tag.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ struct tag {
1313
};
1414
#define lookup_tag(r, o) lookup_tag_##r(o)
1515
extern struct tag *lookup_tag_the_repository(const struct object_id *oid);
16-
extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long size);
16+
#define parse_tag_buffer(r, i, d, s) parse_tag_buffer_##r(i, d, s)
17+
extern int parse_tag_buffer_the_repository(struct tag *item, const void *data, unsigned long size);
1718
extern int parse_tag(struct tag *item);
1819
extern void release_tag_memory(struct tag *t);
1920
extern struct object *deref_tag(struct object *, const char *, int);

0 commit comments

Comments
 (0)