[RFC][PATCH] object.c: use has_object() instead of repo_has_object_file()
- From
Kousik Sanagavarapu <five231003@gmail.com>
- Date
- Nov 16, 2022, 16:39 UTC
- Message-ID
- <20221116163956.1039137-1-five231003@gmail.com>
It is mentioned in object-store.h that the function repo_has_object_file() is deprecated. One possible alternative for this function is has_object() (or atleast that is how I understood it).
The file object-store.h also mentions that repo_has_object_file() and its fellow functions and macros can be removed once the migrations take place. This patch therefore is an attempt to reduce the usage of these functions and macros.
I request for comments as I'm not really sure about the "flags" argument of the has_object() function and its usage in this patch.
Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com> --- object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/object.c b/object.c index 8a74eb85e9..0a9516137a 100644 --- a/object.c +++ b/object.c @@ -286,8 +286,8 @@ struct object *parse_object_with_flags(struct repository *r, return &commit->object; } - if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) || - (!obj && repo_has_object_file(r, oid) && + if ((obj && obj->type == OBJ_BLOB && has_object(r, oid, 0)) || + (!obj && has_object(r, oid, 0) && oid_object_info(r, oid, NULL) == OBJ_BLOB)) { if (!skip_hash && stream_object_signature(r, repl) < 0) { error(_("hash mismatch %s"), oid_to_hex(oid));
-- 2.25.1