commit - 4277420a1f45ca37345733120cbe89d19c550f92
commit + 5903ff6ef10b567d1d0d6c30317ed5b35d71e488
blob - 7eafcbdfc6475382a3c4e3036819fe4661d0da42
blob + 3c6ad6074d6b6b8a2339c9beffc2e8d30e7d7600
--- lib/repository.c
+++ lib/repository.c
}
while ((dent = readdir(dir)) != NULL) {
char *id_str;
+ int cmp;
+
if (strcmp(dent->d_name, ".") == 0 ||
strcmp(dent->d_name, "..") == 0)
continue;
if (!got_parse_sha1_digest(id.sha1, id_str))
continue;
- if (strncmp(id_str_prefix, id_str,
- strlen(id_str_prefix)) != 0) {
+ cmp = strncmp(id_str, id_str_prefix, strlen(id_str_prefix));
+ if (cmp < 0) {
free(id_str);
continue;
+ } else if (cmp > 0) {
+ free(id_str);
+ break;
}
if (*unique_id == NULL) {