convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0);
origin->file.ptr = buf.buf;
origin->file.size = buf.len;
- pretend_object_file(the_repository, buf.buf, buf.len, OBJ_BLOB, &origin->blob_oid);
+ odb_pretend_object(the_repository->objects, buf.buf, buf.len,
+ OBJ_BLOB, &origin->blob_oid);
/*
* Read the current index, replace the path entry with
return type;
}
-int pretend_object_file(struct repository *repo,
- void *buf, unsigned long len, enum object_type type,
- struct object_id *oid)
+int odb_pretend_object(struct object_database *odb,
+ void *buf, unsigned long len, enum object_type type,
+ struct object_id *oid)
{
struct cached_object_entry *co;
char *co_buf;
- hash_object_file(repo->hash_algo, buf, len, type, oid);
- if (odb_has_object(repo->objects, oid, 0) ||
- find_cached_object(repo->objects, oid))
+ hash_object_file(odb->repo->hash_algo, buf, len, type, oid);
+ if (odb_has_object(odb, oid, 0) ||
+ find_cached_object(odb, oid))
return 0;
- ALLOC_GROW(repo->objects->cached_objects,
- repo->objects->cached_object_nr + 1, repo->objects->cached_object_alloc);
- co = &repo->objects->cached_objects[repo->objects->cached_object_nr++];
+ ALLOC_GROW(odb->cached_objects,
+ odb->cached_object_nr + 1, odb->cached_object_alloc);
+ co = &odb->cached_objects[odb->cached_object_nr++];
co->value.size = len;
co->value.type = type;
co_buf = xmalloc(len);
* object in persistent storage before writing any other new objects
* that reference it.
*/
-int pretend_object_file(struct repository *repo,
- void *buf, unsigned long len, enum object_type type,
- struct object_id *oid);
+int odb_pretend_object(struct object_database *odb,
+ void *buf, unsigned long len, enum object_type type,
+ struct object_id *oid);
struct object_info {
/* Request */