]> git.ipfire.org Git - thirdparty/git.git/commitdiff
odb: rename `pretend_object_file()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Jun 2025 06:47:06 +0000 (08:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Jun 2025 15:52:02 +0000 (08:52 -0700)
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
blame.c
odb.c
odb.h

diff --git a/blame.c b/blame.c
index 858d2d74df98fb0d6f983ffdd62275e16e54335a..dce5c8d855c43826be3a00b684e289b2bf86deaf 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -277,7 +277,8 @@ static struct commit *fake_working_tree_commit(struct repository *r,
        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
diff --git a/odb.c b/odb.c
index 4dccb9215d8d6d1d64546e1ac4b6f0e1444e0450..f6231a0556d5f86b2aa1fb8f18069bf26d246548 100644 (file)
--- a/odb.c
+++ b/odb.c
@@ -863,21 +863,21 @@ int odb_read_object_info(struct object_database *odb,
        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);
diff --git a/odb.h b/odb.h
index 2532c4904619dabb384fb358989b4f0772f5bf1a..e4c51f8c38e9e6d742cf2db6f61b36ebf5ae91ed 100644 (file)
--- a/odb.h
+++ b/odb.h
@@ -282,9 +282,9 @@ void *odb_read_object(struct object_database *odb,
  * 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 */