aboutsummaryrefslogtreecommitdiff
path: root/revision.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 12:07:00 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 12:07:00 -0700
commit01796b0e9180f92ed23aa8dc2261857b9dec7d13 (patch)
treea993c92293f2ea7afbac1e637167830d7f003d7d /revision.h
parent89d21f4b649d5d31b18da3220608cb349f29e650 (diff)
downloadgit-01796b0e9180f92ed23aa8dc2261857b9dec7d13.tar.gz
git-01796b0e9180f92ed23aa8dc2261857b9dec7d13.tar.xz
Make "revision.h" slightly better to use.
- 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.
Diffstat (limited to 'revision.h')
-rw-r--r--revision.h16
1 files changed, 10 insertions, 6 deletions
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)