fast-import: don't fail on omitted committer name
[gitweb.git] / sha1-array.c
index 5b75a5a35d7bbf20c9f5794e27b4d6ed3d91954a..b2f47f98fbba26ff7cab4c8651f4c4097e933f84 100644 (file)
@@ -41,3 +41,19 @@ void sha1_array_clear(struct sha1_array *array)
        array->alloc = 0;
        array->sorted = 0;
 }
+
+void sha1_array_for_each_unique(struct sha1_array *array,
+                               for_each_sha1_fn fn,
+                               void *data)
+{
+       int i;
+
+       if (!array->sorted)
+               sha1_array_sort(array);
+
+       for (i = 0; i < array->nr; i++) {
+               if (i > 0 && !hashcmp(array->sha1[i], array->sha1[i-1]))
+                       continue;
+               fn(array->sha1[i], data);
+       }
+}