aboutsummaryrefslogtreecommitdiff
path: root/mailmap.c
diff options
context:
space:
mode:
authorBurak Kaan Karaçay <bkkaracay@gmail.com>2026-02-20 09:04:41 +0300
committerJunio C Hamano <gitster@pobox.com>2026-02-20 08:13:58 -0800
commit999b09348d6302d018165b4b3d289d4579d08e9e (patch)
tree8ff2d5e150b4c83f73134086c0343cb06793318c /mailmap.c
parent73fd77805fc6406f31c36212846d9e2541d19321 (diff)
downloadgit-999b09348d6302d018165b4b3d289d4579d08e9e.tar.xz
mailmap: stop using the_repository
The 'read_mailmap' and 'read_mailmap_blob' functions rely on the global 'the_repository' variable. Update both functions to accept a 'struct repository' parameter. Update all callers to pass 'the_repository' to retain the current behavior. Signed-off-by: Burak Kaan Karaçay <bkkaracay@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailmap.c')
-rw-r--r--mailmap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mailmap.c b/mailmap.c
index 37fd158a51..cf70956675 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -183,7 +183,8 @@ static void read_mailmap_string(struct string_list *map, char *buf)
}
}
-int read_mailmap_blob(struct string_list *map, const char *name)
+int read_mailmap_blob(struct repository *repo, struct string_list *map,
+ const char *name)
{
struct object_id oid;
char *buf;
@@ -192,10 +193,10 @@ int read_mailmap_blob(struct string_list *map, const char *name)
if (!name)
return 0;
- if (repo_get_oid(the_repository, name, &oid) < 0)
+ if (repo_get_oid(repo, name, &oid) < 0)
return 0;
- buf = odb_read_object(the_repository->objects, &oid, &type, &size);
+ buf = odb_read_object(repo->objects, &oid, &type, &size);
if (!buf)
return error("unable to read mailmap object at %s", name);
if (type != OBJ_BLOB) {
@@ -209,7 +210,7 @@ int read_mailmap_blob(struct string_list *map, const char *name)
return 0;
}
-int read_mailmap(struct string_list *map)
+int read_mailmap(struct repository *repo, struct string_list *map)
{
int err = 0;
@@ -224,7 +225,7 @@ int read_mailmap(struct string_list *map)
startup_info->have_repository ?
MAILMAP_NOFOLLOW : 0);
if (startup_info->have_repository)
- err |= read_mailmap_blob(map, git_mailmap_blob);
+ err |= read_mailmap_blob(repo, map, git_mailmap_blob);
err |= read_mailmap_file(map, git_mailmap_file, 0);
return err;
}