diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-07-01 14:22:19 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-01 14:46:35 -0700 |
| commit | 1b1679c6883f948b19599f11229ff61124b51733 (patch) | |
| tree | ef32c258741e65d44134ac1b73b761b372a2aac1 /odb.c | |
| parent | 961038856bcd319289a226e29503358123c0a1ba (diff) | |
| download | git-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.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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); } |
