list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "Derrick Stolee via GitGitGadget" <>
Cc: Derrick Stolee <>,
	Derrick Stolee <>
Subject: [PATCH] maintenance: core.commitGraph=false prevents writes
Date: Mon, 12 Oct 2020 13:28:34 +0000	[thread overview]
Message-ID: <> (raw)

From: Derrick Stolee <>

Recently, a user had an issue due to combining
fetch.writeCommitGraph=true with core.commitGraph=false. The root bug
has been resolved by preventing commit-graph writes when
core.commitGraph is disabled. This happens inside the 'git commit-graph
write' command, but we can be more aware of this situation and prevent
that process from ever starting in the 'commit-graph' maintenance task.

Signed-off-by: Derrick Stolee <>
    maintenance: core.commitGraph=false prevents writes
    As requested [1], this prevents the extra process when core.commitGraph
    is disabled.
    This is based on ds/maintenance-commit-graph-auto-fix.
    Thanks, -Stolee

Fetch-It-Via: git fetch pr-749/derrickstolee/maintenance-core-commit-graph-v1

 builtin/gc.c           | 4 ++++
 t/ | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/builtin/gc.c b/builtin/gc.c
index 12ddb68bba..e80331c4e2 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -813,6 +813,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;
 	if (run_write_commit_graph(opts)) {
 		error(_("failed to write commit-graph"));
diff --git a/t/ b/t/
index ee1f4a7ae4..9776154a2a 100755
--- a/t/
+++ b/t/
@@ -52,6 +52,14 @@ test_expect_success 'run --task=<task>' '
 	test_subcommand git commit-graph write --split --reachable --no-progress <run-both.txt
+test_expect_success 'core.commitGraph=false prevents write process' '
+	GIT_TRACE2_EVENT="$(pwd)/no-commit-graph.txt" \
+		git -c core.commitGraph=false maintenance run \
+		--task=commit-graph 2>/dev/null &&
+	test_subcommand ! git commit-graph write --split --reachable --no-progress \
+		<no-commit-graph.txt
 test_expect_success 'commit-graph auto condition' '
 	COMMAND="maintenance run --task=commit-graph --auto --quiet" &&

base-commit: 8f801804befa12a9c4ddff91275cf03612f1895d

             reply	other threads:[~2020-10-12 13:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 13:28 Derrick Stolee via GitGitGadget [this message]
2020-10-12 17:30 ` Junio C Hamano
2020-10-12 18:40   ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \
    --subject='Re: [PATCH] maintenance: core.commitGraph=false prevents writes' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for project(s) associated with this inbox:

AGPL code for this site: git clone