aboutsummaryrefslogtreecommitdiff
path: root/odb.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-01 14:22:19 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-01 14:46:35 -0700
commit1b1679c6883f948b19599f11229ff61124b51733 (patch)
treeef32c258741e65d44134ac1b73b761b372a2aac1 /odb.c
parent961038856bcd319289a226e29503358123c0a1ba (diff)
downloadgit-1b1679c6883f948b19599f11229ff61124b51733.tar.xz
odb: get rid of `the_repository` in `odb_mkstemp()`
Get rid of our dependency on `the_repository` in `odb_mkstemp()` by passing in the object database as a parameter and adjusting all callers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'odb.c')
-rw-r--r--odb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/odb.c b/odb.c
index d0ca299077..8967e9fd54 100644
--- a/odb.c
+++ b/odb.c
@@ -63,7 +63,8 @@ static const struct cached_object *find_cached_object(struct object_database *ob
return NULL;
}
-int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
+int odb_mkstemp(struct object_database *odb,
+ struct strbuf *temp_filename, const char *pattern)
{
int fd;
/*
@@ -71,15 +72,15 @@ int odb_mkstemp(struct strbuf *temp_filename, const char *pattern)
* restrictive except to remove write permission.
*/
int mode = 0444;
- repo_git_path_replace(the_repository, temp_filename, "objects/%s", pattern);
+ repo_git_path_replace(odb->repo, temp_filename, "objects/%s", pattern);
fd = git_mkstemp_mode(temp_filename->buf, mode);
if (0 <= fd)
return fd;
/* slow path */
/* some mkstemp implementations erase temp_filename on failure */
- repo_git_path_replace(the_repository, temp_filename, "objects/%s", pattern);
- safe_create_leading_directories(the_repository, temp_filename->buf);
+ repo_git_path_replace(odb->repo, temp_filename, "objects/%s", pattern);
+ safe_create_leading_directories(odb->repo, temp_filename->buf);
return xmkstemp_mode(temp_filename->buf, mode);
}