aboutsummaryrefslogtreecommitdiffstats
path: root/object-file.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-07-17 06:56:34 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-16 22:16:15 -0700
commit0f9b18935745fcdebcad613a6e3e52db5b29b1d4 (patch)
tree321254d37ee0e0935d33f86c376361b0dc5a76de /object-file.c
parentobject-file: get rid of `the_repository` in `finalize_object_file()` (diff)
downloadgit-0f9b18935745fcdebcad613a6e3e52db5b29b1d4.tar.gz
git-0f9b18935745fcdebcad613a6e3e52db5b29b1d4.zip
loose: write loose objects map via their source
When a repository is configured to have a compatibility hash algorithm we keep track of object ID mappings for loose objects via the loose object map. This map simply maps an object ID of the actual hash to the object ID of the compatibility hash. This loose object map is an inherent property of the loose files backend and thus of one specific object source. Refactor the interfaces to reflect this by requiring a `struct odb_source` as input instead of a repository. This prepares for subsequent commits where we will refactor writing of loose objects to work on a `struct odb_source`, as well. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-file.c')
-rw-r--r--object-file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/object-file.c b/object-file.c
index 6a7049a9e9..a9248760a2 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1025,7 +1025,7 @@ int stream_loose_object(struct input_stream *in_stream, size_t len,
err = finalize_object_file_flags(the_repository, tmp_file.buf, filename.buf,
FOF_SKIP_COLLISION_CHECK);
if (!err && compat)
- err = repo_add_loose_object_map(the_repository, oid, &compat_oid);
+ err = repo_add_loose_object_map(the_repository->objects->sources, oid, &compat_oid);
cleanup:
strbuf_release(&tmp_file);
strbuf_release(&filename);
@@ -1069,7 +1069,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
if (write_loose_object(oid, hdr, hdrlen, buf, len, 0, flags))
return -1;
if (compat)
- return repo_add_loose_object_map(repo, oid, &compat_oid);
+ return repo_add_loose_object_map(repo->objects->sources, oid, &compat_oid);
return 0;
}
@@ -1103,7 +1103,7 @@ int force_object_loose(const struct object_id *oid, time_t mtime)
hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
ret = write_loose_object(oid, hdr, hdrlen, buf, len, mtime, 0);
if (!ret && compat)
- ret = repo_add_loose_object_map(the_repository, oid, &compat_oid);
+ ret = repo_add_loose_object_map(the_repository->objects->sources, oid, &compat_oid);
free(buf);
return ret;