mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
1efe0aeaa2
commit
cbb388f3e5
4
http.c
4
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;
|
||||
|
||||
Reference in New Issue
Block a user