Re: [PATCH v2 06/12] commit: force commit to parse from object database
From: Martin Ågren <hidden>
Date: 2018-05-12 20:54:24
On 11 May 2018 at 23:15, Derrick Stolee [off-list ref] wrote:
quoted hunk ↗ jump to hunk
-int parse_commit_gently(struct commit *item, int quiet_on_missing) +int parse_commit_internal(struct commit *item, int quiet_on_missing, int use_commit_graph) { enum object_type type; void *buffer;@@ -403,17 +403,17 @@ int parse_commit_gently(struct commit *item, int quiet_on_missing) return -1; if (item->object.parsed) return 0; - if (parse_commit_in_graph(item)) + if (use_commit_graph && parse_commit_in_graph(item)) return 0;
Right, this is where we check the graph. It's the only place we need to consider the new flag.
buffer = read_sha1_file(item->object.oid.hash, &type, &size);
if (!buffer)
return quiet_on_missing ? -1 :
error("Could not read %s",
- oid_to_hex(&item->object.oid));
+ oid_to_hex(&item->object.oid));
if (type != OBJ_COMMIT) {
free(buffer);
return error("Object %s not a commit",
- oid_to_hex(&item->object.oid));
+ oid_to_hex(&item->object.oid));Some spurious indentation reshuffling going on in two lines here.
quoted hunk ↗ jump to hunk
--- a/commit.h +++ b/commit.h@@ -73,6 +73,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); int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size, int check_graph); +int parse_commit_internal(struct commit *item, int quiet_on_missing, int use_commit_graph);
Unlike my comment on a previous patch, this one is meant for external use. That's why it's not marked as static above. Ok. Martin