diff options
author | Junio C Hamano <gitster@pobox.com> | 2025-04-23 13:58:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-04-23 13:58:50 -0700 |
commit | bb74c0abbc31da35be52999569ea481ebd149d1d (patch) | |
tree | e10db152ee6486a1b9af0f7990a140730ebe0ce2 /object.c | |
parent | 68cd0cfa7ef753cc5549aa7882790565d51b9133 (diff) | |
parent | a52d459e72b890c192485002ec518bb9e01c19a6 (diff) |
Merge branch 'kn/bundle-dedup-optim'
Optimize the code to dedup references recorded in a bundle file.
* kn/bundle-dedup-optim:
bundle: fix non-linear performance scaling with refs
t6020: test for duplicate refnames in bundle creation
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 35 |
1 files changed, 1 insertions, 34 deletions
@@ -492,44 +492,11 @@ void object_array_clear(struct object_array *array) array->nr = array->alloc = 0; } -/* - * Return true if array already contains an entry. - */ -static int contains_object(struct object_array *array, - const struct object *item, const char *name) -{ - unsigned nr = array->nr, i; - struct object_array_entry *object = array->objects; - - for (i = 0; i < nr; i++, object++) - if (item == object->item && !strcmp(object->name, name)) - return 1; - return 0; -} - -void object_array_remove_duplicates(struct object_array *array) -{ - unsigned nr = array->nr, src; - struct object_array_entry *objects = array->objects; - - array->nr = 0; - for (src = 0; src < nr; src++) { - if (!contains_object(array, objects[src].item, - objects[src].name)) { - if (src != array->nr) - objects[array->nr] = objects[src]; - array->nr++; - } else { - object_array_release_entry(&objects[src]); - } - } -} - void clear_object_flags(struct repository *repo, unsigned flags) { int i; - for (i=0; i < repo->parsed_objects->obj_hash_size; i++) { + for (i = 0; i < repo->parsed_objects->obj_hash_size; i++) { struct object *obj = repo->parsed_objects->obj_hash[i]; if (obj) obj->flags &= ~flags; |