Skip to content

Commit

Permalink
fixup! path-walk API: avoid adding a root tree more than once
Browse files Browse the repository at this point in the history
Ooops. Must not risk a segmentation fault in a partial clone missing
trees...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 8, 2024
1 parent ed7f388 commit d53e464
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions path-walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d53e464

Please sign in to comment.