Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:39 +0300
committerJunio C Hamano <gitster@pobox.com>2020-11-03 00:17:39 +0300
commit0be2d65132d6b75b2146c28eb024568afa242739 (patch)
tree8db4469f8c907728618fe84edfda9ce83c6feab5 /builtin/gc.c
parent307a53dd9914f65c9b6399221574e24234e4b49f (diff)
parentd334107c5da27e5212e21e77da03e938ea6db976 (diff)
Merge branch 'ds/maintenance-commit-graph-auto-fix'
Test-coverage enhancement of running commit-graph task "git maintenance" as needed led to discovery and fix of a bug. * ds/maintenance-commit-graph-auto-fix: maintenance: core.commitGraph=false prevents writes maintenance: test commit-graph auto condition
Diffstat (limited to 'builtin/gc.c')
-rw-r--r--builtin/gc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 2b99596ec8..3629a82299 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -739,9 +739,15 @@ static int dfs_on_ref(const char *refname,
commit = lookup_commit(the_repository, oid);
if (!commit)
return 0;
- if (parse_commit(commit))
+ if (parse_commit(commit) ||
+ commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH)
return 0;
+ data->num_not_in_graph++;
+
+ if (data->num_not_in_graph >= data->limit)
+ return 1;
+
commit_list_append(commit, &stack);
while (!result && stack) {
@@ -809,6 +815,10 @@ static int run_write_commit_graph(struct maintenance_run_opts *opts)
static int maintenance_task_commit_graph(struct maintenance_run_opts *opts)
{
+ prepare_repo_settings(the_repository);
+ if (!the_repository->settings.core_commit_graph)
+ return 0;
+
close_object_store(the_repository->objects);
if (run_write_commit_graph(opts)) {
error(_("failed to write commit-graph"));