Commit 69dca959508cd04b226b3747c0c07f89f3bd1a87

Vicent Marti 2010-05-25T22:30:09

Fixed parsing commit times (they weren't being stored at all!) Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>

diff --git a/src/commit.c b/src/commit.c
index 2e3e1ba..53d25ee 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -132,12 +132,19 @@ int git_commit__parse_time(time_t *commit_time, char *buffer, const char *buffer
     if (memcmp(buffer, "committer ", 10) != 0)
         return -1;
 
-    buffer = memchr(buffer, '\n', buffer_end - buffer);
+    buffer = memchr(buffer, '>', buffer_end - buffer);
     if (buffer == 0 || ++buffer >= buffer_end)
         return -1;
 
     *commit_time = strtol(buffer, &buffer, 10);
 
+    if (*commit_time == 0)
+        return -1;
+
+    buffer = memchr(buffer, '\n', buffer_end - buffer);
+    if (buffer == 0 || ++buffer >= buffer_end)
+        return -1;
+
     return (buffer < buffer_end) ? 0 : -1;
 }
 
diff --git a/src/revwalk.c b/src/revwalk.c
index eccaf6f..977c179 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -64,10 +64,10 @@ void gitrp_sorting(git_revpool *pool, unsigned int sort_mode)
 
 void gitrp_push(git_revpool *pool, git_commit *commit)
 {
-    if (commit->object.pool != pool || pool->walking)
+    if (commit == NULL || commit->seen)
         return;
 
-    if (commit->seen)
+    if (commit->object.pool != pool || pool->walking)
         return;
 
     if (!commit->parsed)