aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-17 06:56:33 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-16 22:16:14 -0700
commitcbb388f3e53660c88220c40a8dddb976672ae03d (patch)
treef664f87596158d4851db3931a23d3459e3d04224 /http.c
parent1efe0aeaa2e10766abe9bf05e2e1a014251ba4e2 (diff)
downloadgit-cbb388f3e53660c88220c40a8dddb976672ae03d.tar.xz
object-file: get rid of `the_repository` in `finalize_object_file()`
We implicitly depend on `the_repository` when moving an object file into place in `finalize_object_file()`. Get rid of this global dependency by passing in a repository. Note that one might be pressed to inject an object database instead of a repository. But the function doesn't really care about the ODB at all. All it does is to move a file into place while checking whether there is any collision. As such, the functionality it provides is independent of the object database and only needs the repository as parameter so that it can adjust permissions of the file we are about to finalize. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/http.c b/http.c
index 9b62f627dc..7cc797116b 100644
--- a/http.c
+++ b/http.c
@@ -2331,7 +2331,7 @@ int http_get_file(const char *url, const char *filename,
ret = http_request_reauth(url, result, HTTP_REQUEST_FILE, options);
fclose(result);
- if (ret == HTTP_OK && finalize_object_file(tmpfile.buf, filename))
+ if (ret == HTTP_OK && finalize_object_file(the_repository, tmpfile.buf, filename))
ret = HTTP_ERROR;
cleanup:
strbuf_release(&tmpfile);
@@ -2815,7 +2815,7 @@ int finish_http_object_request(struct http_object_request *freq)
return -1;
}
odb_loose_path(the_repository->objects->sources, &filename, &freq->oid);
- freq->rename = finalize_object_file(freq->tmpfile.buf, filename.buf);
+ freq->rename = finalize_object_file(the_repository, freq->tmpfile.buf, filename.buf);
strbuf_release(&filename);
return freq->rename;