X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=commit.c;h=e2bcbe814936989e7a86018e46ed6ca86f4c1f10;hb=a0f4afbe87ddda7902e36350d163dea146166550;hp=cf72143f58346c93879a98709d5d6fa8a0981b40;hpb=7de265a4cfd2c6dbe1c7af8c592a23ede08ec854;p=git.git diff --git a/commit.c b/commit.c index cf72143f5..e2bcbe814 100644 --- a/commit.c +++ b/commit.c @@ -5,7 +5,6 @@ #include "utf8.h" #include "diff.h" #include "revision.h" -#include "notes.h" int save_commit_buffer = 1; @@ -51,7 +50,6 @@ struct commit *lookup_commit(const unsigned char *sha1) static unsigned long parse_commit_date(const char *buf, const char *tail) { - unsigned long date; const char *dateptr; if (buf + 6 >= tail) @@ -74,10 +72,7 @@ static unsigned long parse_commit_date(const char *buf, const char *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; @@ -267,7 +262,11 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size) bufptr[47] != '\n') return error("bad parents in commit %s", sha1_to_hex(item->object.sha1)); bufptr += 48; - if (graft) + /* + * The clone is shallow if nr_parent < 0, and we must + * not traverse its real parents even when we unhide them. + */ + if (graft && (graft->nr_parent < 0 || grafts_replace_parents)) continue; new_parent = lookup_commit(parent); if (new_parent)