commit-graph: define GIT_TEST_COMMIT_GRAPH
[gitweb.git] / commit-graph.c
index 0034740c26b48eda147d45258505df278b84cc0a..1643a0a816e0d38ac4b41303dab9e621d03d61ee 100644 (file)
@@ -213,8 +213,9 @@ static int prepare_commit_graph(struct repository *r)
                return !!r->objects->commit_graph;
        r->objects->commit_graph_attempted = 1;
 
-       if (repo_config_get_bool(r, "core.commitgraph", &config_value) ||
-           !config_value)
+       if (!git_env_bool(GIT_TEST_COMMIT_GRAPH, 0) &&
+           (repo_config_get_bool(r, "core.commitgraph", &config_value) ||
+           !config_value))
                /*
                 * This repository is not configured to use commit graphs, so
                 * do not load one. (But report commit_graph_attempted anyway
@@ -730,7 +731,7 @@ void write_commit_graph(const char *obj_dir,
                                die(_("error adding pack %s"), packname.buf);
                        if (open_pack_index(p))
                                die(_("error opening index for %s"), packname.buf);
-                       for_each_object_in_pack(p, add_packed_commits, &oids);
+                       for_each_object_in_pack(p, add_packed_commits, &oids, 0);
                        close_pack(p);
                }
                strbuf_release(&packname);