Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
commit.c: allow parse_commit_buffer to handle arbitrary repositories
author
Stefan Beller
<sbeller@google.com>
Fri, 29 Jun 2018 01:22:13 +0000
(18:22 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 29 Jun 2018 17:43:40 +0000
(10:43 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.c
patch
|
blob
|
history
commit.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
84f80cd
)
diff --git
a/commit.c
b/commit.c
index 8749e15145105e5a291e087ef6f50d134d58540a..41d233520981b76c9db648e3dcb1500b88040eb4 100644
(file)
--- a/
commit.c
+++ b/
commit.c
@@
-364,7
+364,7
@@
const void *detach_commit_buffer(struct commit *commit, unsigned long *sizep)
return ret;
}
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;
{
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));
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;
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;
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;
*/
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;
}
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++) {
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;
&graft->parent[i]);
if (!new_parent)
continue;
diff --git
a/commit.h
b/commit.h
index 27888d824686e4f11527f250e7663127e0e6558d..e9cb5aaaae9dbef88552fe92dca5c1e671b912bc 100644
(file)
--- a/
commit.h
+++ b/
commit.h
@@
-81,8
+81,7
@@
struct commit *lookup_commit_reference_by_name(const char *name);
*/
struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name);
*/
struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref_name);
-#define parse_commit_buffer(r, i, b, s, g) parse_commit_buffer_##r(i, b, s, g)
-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);
int parse_commit_gently(struct commit *item, int quiet_on_missing);
static inline int parse_commit(struct commit *item)
{
int parse_commit_gently(struct commit *item, int quiet_on_missing);
static inline int parse_commit(struct commit *item)
{