Skip to content

Commit 83f0412

Browse files
kjbracey2gitster
authored andcommitted
decorate.c: compact table when growing
When growing the table, take the opportunity to "compact" it by removing entries with NULL decoration. Users may have "removed" decorations by passing NULL to insert_decoration. An object's table entry can't actually be removed during normal operation, as it would break the linear hash collision search. But we can remove NULL decoration entries when rebuilding the table. Signed-off-by: Kevin Bracey <kevin@bracey.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a765499 commit 83f0412

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

decorate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void grow_decoration(struct decoration *n)
4949
const struct object *base = old_hash[i].base;
5050
void *decoration = old_hash[i].decoration;
5151

52-
if (!base)
52+
if (!decoration)
5353
continue;
5454
insert_decoration(n, base, decoration);
5555
}

0 commit comments

Comments
 (0)