summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c8400d9)
raw | patch | inline | side by side (parent: c8400d9)
author | Eric Wong <normalperson@yhbt.net> | |
Fri, 3 Jul 2009 04:34:54 +0000 (21:34 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Jul 2009 16:36:16 +0000 (09:36 -0700) |
It is common practice to use the Unix epoch as a fallback date
when a suitable date is not available. This is true of git svn
and possibly other importing tools that import non-git history
into git.
Instead of clobbering established strtoul() error reporting
semantics with our own, preserve the strtoul() error value
of ULONG_MAX for fsck.c to handle.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when a suitable date is not available. This is true of git svn
and possibly other importing tools that import non-git history
into git.
Instead of clobbering established strtoul() error reporting
semantics with our own, preserve the strtoul() error value
of ULONG_MAX for fsck.c to handle.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c | patch | blob | history | |
fsck.c | patch | blob | history |
diff --git a/commit.c b/commit.c
index aa3b35b6a86891ac9d0628e20a6a46d506bf7700..a47fb4da271beaf5595b6bbbe41f94bad08f404d 100644 (file)
--- a/commit.c
+++ b/commit.c
static unsigned long parse_commit_date(const char *buf, const char *tail)
{
- unsigned long date;
const char *dateptr;
if (buf + 6 >= tail)
if (buf >= tail)
return 0;
/* dateptr < buf && buf[-1] == '\n', so strtoul will stop at buf-1 */
- date = strtoul(dateptr, NULL, 10);
- if (date == ULONG_MAX)
- date = 0;
- return date;
+ return strtoul(dateptr, NULL, 10);
}
static struct commit_graft **commit_graft;
index 511b82cba9977c14d6dcba5efbd6d38591d3aacc..89278c1459d36a3e2b718661ca71483522f587fd 100644 (file)
--- a/fsck.c
+++ b/fsck.c
struct commit_graft *graft;
int parents = 0;
- if (!commit->date)
+ if (commit->date == ULONG_MAX)
return error_func(&commit->object, FSCK_ERROR, "invalid author/committer line");
if (memcmp(buffer, "tree ", 5))