[PATCH 4/7] commit-graph: use obj->type, not object_as_type()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change a check of a deref_tag() return value to just use obj->type
instead of object_as_type(). The object_as_type() function is for
low-level use by fsck, {commit,tree,blob,tag}.c and the like, here we
can just assume the object is fully initialized.

As can be seen in plenty of existing uses in our codebase the return
value of deref_tag() won't be an obj->type == OBJ_NONE or
!obj->parsed. Fixes code added in 2f00c355cb7 (commit-graph: drop
COMMIT_GRAPH_WRITE_CHECK_OIDS flag, 2020-05-13).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 builtin/commit-graph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index cd86315221..347d65abc8 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -158,7 +158,7 @@ static int read_one_commit(struct oidset *commits, struct progress *progress,
 			   NULL, 0);
 	if (!result)
 		return error(_("invalid object: %s"), hash);
-	else if (object_as_type(result, OBJ_COMMIT, 1))
+	else if (result->type == OBJ_COMMIT)
 		oidset_insert(commits, &result->oid);
 
 	display_progress(progress, oidset_size(commits));
-- 
2.31.1.592.gdf54ba9003




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux