diff options
-rw-r--r-- | fsck-cache.c | 2 | ||||
-rw-r--r-- | revision.h | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/fsck-cache.c b/fsck-cache.c index 3fbcd2c7e..a8050f84a 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -186,7 +186,7 @@ int main(int argc, char **argv) continue; } if (!get_sha1_hex(argv[i], head_sha1)) { - mark_reachable(lookup_rev(head_sha1)); + mark_reachable(lookup_rev(head_sha1), REACHABLE); heads++; continue; } diff --git a/revision.h b/revision.h index 2bad6c01a..f965f3fc5 100644 --- a/revision.h +++ b/revision.h @@ -97,22 +97,24 @@ static struct revision *add_relationship(struct revision *rev, unsigned char *ne return parent_rev; } -static void mark_reachable(struct revision *rev) +static void mark_reachable(struct revision *rev, unsigned int mask) { struct parent *p = rev->parent; /* If we've been here already, don't bother */ - if (rev->flags & REACHABLE) + if (rev->flags & mask) return; - rev->flags |= REACHABLE | USED; + rev->flags |= mask | USED; while (p) { - mark_reachable(p->parent); + mark_reachable(p->parent, mask); p = p->next; } } static unsigned long parse_commit_date(const char *buf) { + unsigned long date; + if (memcmp(buf, "author", 6)) return 0; while (*buf++ != '\n') @@ -121,8 +123,10 @@ static unsigned long parse_commit_date(const char *buf) return 0; while (*buf++ != '>') /* nada */; - - return strtoul(buf, NULL, 10); + date = strtoul(buf, NULL, 10); + if (date == ULONG_MAX) + date = 0; + return date; } static int parse_commit(unsigned char *sha1) |