Skip to content

Commit 7fd464c

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 0a8fae9 commit 7fd464c

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
@@ -863,21 +863,21 @@ int odb_read_object_info(struct object_database *odb,
863863
return type;
864864
}
865865

866-
int pretend_object_file(struct repository *repo,
867-
void *buf, unsigned long len, enum object_type type,
868-
struct object_id *oid)
866+
int odb_pretend_object(struct object_database *odb,
867+
void *buf, unsigned long len, enum object_type type,
868+
struct object_id *oid)
869869
{
870870
struct cached_object_entry *co;
871871
char *co_buf;
872872

873-
hash_object_file(repo->hash_algo, buf, len, type, oid);
874-
if (odb_has_object(repo->objects, oid, 0) ||
875-
find_cached_object(repo->objects, oid))
873+
hash_object_file(odb->repo->hash_algo, buf, len, type, oid);
874+
if (odb_has_object(odb, oid, 0) ||
875+
find_cached_object(odb, oid))
876876
return 0;
877877

878-
ALLOC_GROW(repo->objects->cached_objects,
879-
repo->objects->cached_object_nr + 1, repo->objects->cached_object_alloc);
880-
co = &repo->objects->cached_objects[repo->objects->cached_object_nr++];
878+
ALLOC_GROW(odb->cached_objects,
879+
odb->cached_object_nr + 1, odb->cached_object_alloc);
880+
co = &odb->cached_objects[odb->cached_object_nr++];
881881
co->value.size = len;
882882
co->value.type = type;
883883
co_buf = xmalloc(len);

odb.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ void *odb_read_object(struct object_database *odb,
282282
* object in persistent storage before writing any other new objects
283283
* that reference it.
284284
*/
285-
int pretend_object_file(struct repository *repo,
286-
void *buf, unsigned long len, enum object_type type,
287-
struct object_id *oid);
285+
int odb_pretend_object(struct object_database *odb,
286+
void *buf, unsigned long len, enum object_type type,
287+
struct object_id *oid);
288288

289289
struct object_info {
290290
/* Request */

0 commit comments

Comments
 (0)