Skip to content

Commit 154717b

Browse files
rscharfegitster
authored andcommitted
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 43a8391 (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>
1 parent e61f227 commit 154717b

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

builtin/tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int verify_tag(const char *name, const char *ref UNUSED,
149149
if (format->format)
150150
flags = GPG_VERIFY_OMIT_STATUS;
151151

152-
if (gpg_verify_tag(oid, name, flags))
152+
if (gpg_verify_tag(the_repository, oid, name, flags))
153153
return -1;
154154

155155
if (format->format)

builtin/verify-tag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int cmd_verify_tag(int argc,
6161
continue;
6262
}
6363

64-
if (gpg_verify_tag(&oid, name, flags)) {
64+
if (gpg_verify_tag(repo, &oid, name, flags)) {
6565
had_error = 1;
6666
continue;
6767
}

tag.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ static int run_gpg_verify(const char *buf, unsigned long size, unsigned flags)
4444
return ret;
4545
}
4646

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)
4949
{
5050
enum object_type type;
5151
char *buf;
5252
unsigned long size;
5353
int ret;
5454

55-
type = odb_read_object_info(the_repository->objects, oid, NULL);
55+
type = odb_read_object_info(r->objects, oid, NULL);
5656
if (type != OBJ_TAG)
5757
return error("%s: cannot verify a non-tag object of type %s.",
5858
name_to_report ?
5959
name_to_report :
60-
repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),
60+
repo_find_unique_abbrev(r, oid, DEFAULT_ABBREV),
6161
type_name(type));
6262

63-
buf = odb_read_object(the_repository->objects, oid, &type, &size);
63+
buf = odb_read_object(r->objects, oid, &type, &size);
6464
if (!buf)
6565
return error("%s: unable to read file.",
6666
name_to_report ?
6767
name_to_report :
68-
repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));
68+
repo_find_unique_abbrev(r, oid, DEFAULT_ABBREV));
6969

7070
ret = run_gpg_verify(buf, size, flags);
7171

tag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, u
1616
int parse_tag(struct tag *item);
1717
void release_tag_memory(struct tag *t);
1818
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,
2020
const char *name_to_report, unsigned flags);
2121
struct object_id *get_tagged_oid(struct tag *tag);
2222

0 commit comments

Comments
 (0)