commit 52d1d0d9000cbe48a58be36218471edd0965e42c from: Stefan Sperling date: Sun Jul 07 16:07:51 2019 UTC fix bug where match_loose_object() skipped some objects commit - 74ff3f23fc46fc032437327d53a5fad7ba699a0d commit + 52d1d0d9000cbe48a58be36218471edd0965e42c blob - db26cffb585d745fe9afb6be031e5ba09ca0ad2e blob + 42b69efba8918ce354a3462a25faa66ef51980dc --- lib/repository.c +++ lib/repository.c @@ -1005,13 +1005,14 @@ match_loose_object(struct got_object_id **unique_id, c if (!got_parse_sha1_digest(id.sha1, id_str)) continue; + /* + * Directory entries do not necessarily appear in + * sorted order, so we must iterate over all of them. + */ cmp = strncmp(id_str, id_str_prefix, strlen(id_str_prefix)); - if (cmp < 0) { + if (cmp != 0) { free(id_str); continue; - } else if (cmp > 0) { - free(id_str); - break; } if (*unique_id == NULL) {