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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
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)