tag: support arbitrary repositories in gpg_verify_tag()
Allow callers of gpg_verify_tag() specify the repository to use by providing a parameter for that. One of the two has not been using the_repository since 43a8391977 (builtin/verify-tag: stop using `the_repository`, 2025-03-08); let it pass in the correct repository. The other simply passes the_repository to get the same result as before. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Dec 28, 2025 at 19:10 UTC
154717b3b0b0631fb6700d5fc77e779106530fc3
4 files changed
+9
-9
builtin/tag.c
+1
-1
@@ -149,7 +149,7 @@ static int verify_tag(const char *name, const char *ref UNUSED,
149
if (format->format)
150
flags = GPG_VERIFY_OMIT_STATUS;
151
152
- if (gpg_verify_tag(oid, name, flags))
152
+ if (gpg_verify_tag(the_repository, oid, name, flags))
153
return -1;
154
155
if (format->format)
builtin/verify-tag.c
+1
-1
@@ -61,7 +61,7 @@ int cmd_verify_tag(int argc,
61
continue;
62
}
63
64
- if (gpg_verify_tag(&oid, name, flags)) {
64
+ if (gpg_verify_tag(repo, &oid, name, flags)) {
65
had_error = 1;
66
continue;
67
}
tag.c
+6
-6
@@ -44,28 +44,28 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
44
return ret;
45
}
46
47
-int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
48
- unsigned flags)
47
+int gpg_verify_tag(struct repository *r, const struct object_id *oid,
48
+ const char *name_to_report, unsigned flags)
49
{
50
enum object_type type;
51
char *buf;
52
unsigned long size;
53
int ret;
54
55
- type = odb_read_object_info(the_repository->objects, oid, NULL);
55
+ type = odb_read_object_info(r->objects, oid, NULL);
56
if (type != OBJ_TAG)
57
return error("%s: cannot verify a non-tag object of type %s.",
58
name_to_report ?
59
name_to_report :
60
- repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),
60
+ repo_find_unique_abbrev(r, oid, DEFAULT_ABBREV),
61
type_name(type));
62
63
- buf = odb_read_object(the_repository->objects, oid, &type, &size);
63
+ buf = odb_read_object(r->objects, oid, &type, &size);
64
if (!buf)
65
return error("%s: unable to read file.",
66
name_to_report ?
67
name_to_report :
68
- repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));
68
+ repo_find_unique_abbrev(r, oid, DEFAULT_ABBREV));
69
70
ret = run_gpg_verify(buf, size, flags);
71
tag.h
+1
-1
@@ -16,7 +16,7 @@ int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, u
16
int parse_tag(struct tag *item);
17
void release_tag_memory(struct tag *t);
18
struct object *deref_tag(struct repository *r, struct object *, const char *, int);
19
-int gpg_verify_tag(const struct object_id *oid,
19
+int gpg_verify_tag(struct repository *r, const struct object_id *oid,
20
const char *name_to_report, unsigned flags);
21
struct object_id *get_tagged_oid(struct tag *tag);
22