From d53e4648cb65eb75dd8d8a093d17400a18a9a15d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 8 Oct 2024 09:13:06 +0200 Subject: [PATCH] fixup! path-walk API: avoid adding a root tree more than once Ooops. Must not risk a segmentation fault in a partial clone missing trees... Signed-off-by: Johannes Schindelin --- path-walk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/path-walk.c b/path-walk.c index 56655211225fd7..10c6dedbab82b1 100644 --- a/path-walk.c +++ b/path-walk.c @@ -360,11 +360,11 @@ int walk_objects_by_path(struct path_walk_info *info) oid = get_commit_tree_oid(c); t = lookup_tree(info->revs->repo, oid); - if (t->object.flags & SEEN) - continue; - t->object.flags |= SEEN; - if (t) { + if (t->object.flags & SEEN) + continue; + t->object.flags |= SEEN; + if (!oidset_insert(&root_tree_set, oid)) oid_array_append(&root_tree_list->oids, oid); } else {