[PATCH 3/5] commit.c: parse 'prior' link
From: Sam Vilain <hidden>
Date: 2016-06-15 22:42:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Sam Vilain <hidden>
Date: 2016-06-15 22:42:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Sam Vilain <redacted> Parse for the 'prior' link in a commit --- commit.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/commit.c b/commit.c
index 2717dd8..e4bc396 100644
--- a/commit.c
+++ b/commit.c@@ -260,6 +260,18 @@ int parse_commit_buffer(struct commit *i n_refs++; } } + if (!memcmp(bufptr, "prior ", 6)) { + unsigned char prior[20]; + if (get_sha1_hex(bufptr + 6, prior) || bufptr[46] != '\n') + return error("bad prior in commit %s", sha1_to_hex(item->object.sha1)); + bufptr += 47; + + item->prior = xmalloc(21); + strncpy(item->prior, (char*)&prior, 20); + item->prior[20] = '\0'; + } else { + item->prior = 0; + } if (graft) { int i; struct commit *new_parent;