- if (rel_allocs == nr_rels) {
- rel_allocs = alloc_nr(rel_allocs);
- rels = realloc(rels, rel_allocs * sizeof(struct relationship *));
+ while (fgets(line, sizeof(line), file)) {
+ unsigned long date;
+ unsigned char sha1[20];
+ struct revision *rev;
+ const char *buf;
+
+ if (sscanf(line, "%lu", &date) != 1)
+ break;
+ buf = strchr(line, ' ');
+ if (!buf)
+ break;
+ if (get_sha1_hex(buf+1, sha1))
+ break;
+ rev = lookup_rev(sha1, "commit");
+ rev->flags |= SEEN;
+ rev->date = date;
+
+ /* parents? */
+ while ((buf = strchr(buf+1, ' ')) != NULL) {
+ unsigned char parent[20];
+ if (get_sha1_hex(buf + 1, parent))
+ break;
+ add_relationship(rev, parent, "commit");
+ }