{
struct odb_source_files *files = odb_source_files_downcast(source);
const struct git_hash_algo *compat = source->odb->repo->compat_hash_algo;
- void *buf = NULL;
- size_t len;
struct object_info oi = OBJECT_INFO_INIT;
- struct object_id compat_oid;
+ struct object_id compat_oid, *compat_oid_p = NULL;
enum object_type type;
- char hdr[MAX_HEADER_LEN];
- int hdrlen;
+ void *buf = NULL;
+ size_t len;
int ret;
for (struct odb_source *s = source->odb->sources; s; s = s->next) {
oid_to_hex(oid), compat->name);
goto out;
}
- }
- hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
- ret = write_loose_object(files->loose, oid, hdr, hdrlen, buf, len, mtime, 0);
- if (ret)
- goto out;
+ compat_oid_p = &compat_oid;
+ }
- if (compat)
- ret = repo_add_loose_object_map(files->loose, oid, &compat_oid);
+ ret = odb_source_write_object(&files->loose->base, buf, len, type, oid,
+ compat_oid_p, mtime, 0);
out:
free(buf);