]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit-graph.c
Merge branch 'js/azure-pipelines-msvc'
[thirdparty/git.git] / commit-graph.c
index c3ba79fe4e11f5b47cf05e29c68a868d29ade1f9..fc4a43b8d6eb112f1c845882b32411c37a402e3b 100644 (file)
@@ -846,12 +846,19 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
 
        while (list < last) {
                struct commit_list *parent;
+               struct object_id *tree;
                int edge_value;
                uint32_t packedDate[2];
                display_progress(ctx->progress, ++ctx->progress_cnt);
 
-               parse_commit_no_graph(*list);
-               hashwrite(f, get_commit_tree_oid(*list)->hash, hash_len);
+               if (parse_commit_no_graph(*list))
+                       die(_("unable to parse commit %s"),
+                               oid_to_hex(&(*list)->object.oid));
+               tree = get_commit_tree_oid(*list);
+               if (!tree)
+                       die(_("unable to get tree for %s"),
+                               oid_to_hex(&(*list)->object.oid));
+               hashwrite(f, tree->hash, hash_len);
 
                parent = (*list)->parents;
 
@@ -1526,8 +1533,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
 
 static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
 {
-       struct commit_graph *g = ctx->r->objects->commit_graph;
-       uint32_t num_commits = ctx->commits.nr;
+       struct commit_graph *g;
+       uint32_t num_commits;
        uint32_t i;
 
        int max_commits = 0;
@@ -1539,6 +1546,7 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
        }
 
        g = ctx->r->objects->commit_graph;
+       num_commits = ctx->commits.nr;
        ctx->num_commit_graphs_after = ctx->num_commit_graphs_before + 1;
 
        while (g && (g->num_commits <= size_mult * num_commits ||