aboutsummaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-06-28 18:22:13 -0700
committerJunio C Hamano <gitster@pobox.com>2018-06-29 10:43:40 -0700
commitfd8030c739522acf3f55879b29f4716b36f4d440 (patch)
treedb9a948336b55cbfd7b98e57d18b478bbaf05012 /commit.c
parent84f80cd2db5daa71a68df9a71c13524700a4edc7 (diff)
downloadgit-fd8030c739522acf3f55879b29f4716b36f4d440.tar.gz
commit.c: allow parse_commit_buffer to handle arbitrary repositories
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/commit.c b/commit.c
index 8749e15145..41d2335209 100644
--- a/commit.c
+++ b/commit.c
@@ -364,7 +364,7 @@ const void *detach_commit_buffer(struct commit *commit, unsigned long *sizep)
return ret;
}
-int parse_commit_buffer_the_repository(struct commit *item, const void *buffer, unsigned long size, int check_graph)
+int parse_commit_buffer(struct repository *r, struct commit *item, const void *buffer, unsigned long size, int check_graph)
{
const char *tail = buffer;
const char *bufptr = buffer;
@@ -384,11 +384,11 @@ int parse_commit_buffer_the_repository(struct commit *item, const void *buffer,
if (get_oid_hex(bufptr + 5, &parent) < 0)
return error("bad tree pointer in commit %s",
oid_to_hex(&item->object.oid));
- item->maybe_tree = lookup_tree(the_repository, &parent);
+ item->maybe_tree = lookup_tree(r, &parent);
bufptr += tree_entry_len + 1; /* "tree " + "hex sha1" + "\n" */
pptr = &item->parents;
- graft = lookup_commit_graft(the_repository, &item->object.oid);
+ graft = lookup_commit_graft(r, &item->object.oid);
while (bufptr + parent_entry_len < tail && !memcmp(bufptr, "parent ", 7)) {
struct commit *new_parent;
@@ -403,7 +403,7 @@ int parse_commit_buffer_the_repository(struct commit *item, const void *buffer,
*/
if (graft && (graft->nr_parent < 0 || grafts_replace_parents))
continue;
- new_parent = lookup_commit(the_repository, &parent);
+ new_parent = lookup_commit(r, &parent);
if (new_parent)
pptr = &commit_list_insert(new_parent, pptr)->next;
}
@@ -411,7 +411,7 @@ int parse_commit_buffer_the_repository(struct commit *item, const void *buffer,
int i;
struct commit *new_parent;
for (i = 0; i < graft->nr_parent; i++) {
- new_parent = lookup_commit(the_repository,
+ new_parent = lookup_commit(r,
&graft->parent[i]);
if (!new_parent)
continue;