summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 89d21f4)
raw | patch | inline | side by side (parent: 89d21f4)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 17 Apr 2005 19:07:00 +0000 (12:07 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Sun, 17 Apr 2005 19:07:00 +0000 (12:07 -0700) |
- mark_reachable() can be more generic, marking the reachable revisions
with an arbitrary mask.
- date parsing will parse to a date of 0 rather than ULONG_MAX for the
bad old case, sorting the dates correctly.
with an arbitrary mask.
- date parsing will parse to a date of 0 rather than ULONG_MAX for the
bad old case, sorting the dates correctly.
fsck-cache.c | patch | blob | history | |
revision.h | patch | blob | history |
diff --git a/fsck-cache.c b/fsck-cache.c
index 3fbcd2c7e99fa5e27fa7edad0e2bd65d3b557fe7..a8050f84a9f13f97c3b5ae719d261ca8f782c2b2 100644 (file)
--- a/fsck-cache.c
+++ b/fsck-cache.c
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 2bad6c01a447a67c2013b0a092ca7afe04b7511e..f965f3fc5f66827759223dc9caf63d9abf40ae15 100644 (file)
--- 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')
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)