Skip to content

Commit 6c5c234

Browse files
pks-tgitster
authored andcommitted
odb: rename pretend_object_file()
Rename `pretend_object_file()` to `odb_pretend_object()` to match other functions related to the object database and our modern coding guidelines. No compatibility wrapper is introduces as the function is not used a lot throughout our codebase. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6abe860 commit 6c5c234

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

blame.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ static struct commit *fake_working_tree_commit(struct repository *r,
277277
convert_to_git(r->index, path, buf.buf, buf.len, &buf, 0);
278278
origin->file.ptr = buf.buf;
279279
origin->file.size = buf.len;
280-
pretend_object_file(the_repository, buf.buf, buf.len, OBJ_BLOB, &origin->blob_oid);
280+
odb_pretend_object(the_repository->objects, buf.buf, buf.len,
281+
OBJ_BLOB, &origin->blob_oid);
281282

282283
/*
283284
* Read the current index, replace the path entry with

odb.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -872,21 +872,21 @@ int odb_read_object_info(struct object_database *odb,
872872
return type;
873873
}
874874

875-
int pretend_object_file(struct repository *repo,
876-
void *buf, unsigned long len, enum object_type type,
877-
struct object_id *oid)
875+
int odb_pretend_object(struct object_database *odb,
876+
void *buf, unsigned long len, enum object_type type,
877+
struct object_id *oid)
878878
{
879879
struct cached_object_entry *co;
880880
char *co_buf;
881881

882-
hash_object_file(repo->hash_algo, buf, len, type, oid);
883-
if (odb_has_object(repo->objects, oid, 0) ||
884-
find_cached_object(repo->objects, oid))
882+
hash_object_file(odb->repo->hash_algo, buf, len, type, oid);
883+
if (odb_has_object(odb, oid, 0) ||
884+
find_cached_object(odb, oid))
885885
return 0;
886886

887-
ALLOC_GROW(repo->objects->cached_objects,
888-
repo->objects->cached_object_nr + 1, repo->objects->cached_object_alloc);
889-
co = &repo->objects->cached_objects[repo->objects->cached_object_nr++];
887+
ALLOC_GROW(odb->cached_objects,
888+
odb->cached_object_nr + 1, odb->cached_object_alloc);
889+
co = &odb->cached_objects[odb->cached_object_nr++];
890890
co->value.size = len;
891891
co->value.type = type;
892892
co_buf = xmalloc(len);

odb.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ void *odb_read_object(struct object_database *odb,
274274
* object in persistent storage before writing any other new objects
275275
* that reference it.
276276
*/
277-
int pretend_object_file(struct repository *repo,
278-
void *buf, unsigned long len, enum object_type type,
279-
struct object_id *oid);
277+
int odb_pretend_object(struct object_database *odb,
278+
void *buf, unsigned long len, enum object_type type,
279+
struct object_id *oid);
280280

281281
struct object_info {
282282
/* Request */

0 commit comments

Comments
 (0)