From: "Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Kristofer Karlsson <krka@spotify.com>,
Kristofer Karlsson <krka@spotify.com>
Subject: [PATCH v5 4/6] connected: add transfer.connectivityCheck config
Date: Fri, 23 Oct 2026 13:11:57 +0000 [thread overview]
Message-ID: <7ef572bc05d96fea05289191c6738751b704fbfb.1792761119.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2211.v5.git.1792761119.gitgitgadget@gmail.com>
From: Kristofer Karlsson <krka@spotify.com>
Add the transfer.connectivityCheck configuration option to choose
the algorithm used for the connectivity check. For now the only
accepted value is "full", which is the existing behavior and the
default. Unknown values fall back to "full" with a warning, so
that configuration written for a newer version of Git does not
break fetches and pushes; "full" is always a correct check.
check_connected() now always tells its rev-list subprocess which
algorithm to use with an internal --connectivity-check=<mode>
option, which so far only accepts "full". Passing the mode
explicitly means rev-list knows it is running a connectivity
check, so later optimizations can be limited to that case.
This prepares for an incremental check added in the next commit.
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
---
Documentation/config/transfer.adoc | 16 ++++++++++++++++
Documentation/rev-list-options.adoc | 5 +++++
builtin/rev-list.c | 22 ++++++++++++++++++++++
connected.c | 26 ++++++++++++++++++++++++++
4 files changed, 69 insertions(+)
diff --git a/Documentation/config/transfer.adoc b/Documentation/config/transfer.adoc
index f1ce50f4a6..811456f1bf 100644
--- a/Documentation/config/transfer.adoc
+++ b/Documentation/config/transfer.adoc
@@ -1,3 +1,19 @@
+transfer.connectivityCheck::
+ Choose which algorithm to use for the connectivity check
+ performed during object transfer operations such as
+ linkgit:git-fetch[1] and linkgit:git-receive-pack[1].
+ The connectivity check verifies that all objects reachable
+ from the incoming tips are available locally or, in a partial
+ clone, promised by a promisor remote.
+ The variants are as follows:
++
+--
+`full` (default);;
+ Walk the full object closure of the boundary commits.
+--
++
+Unknown values are treated as `full`, with a warning.
+
transfer.credentialsInUrl::
A configured URL can contain plaintext credentials in the form
`<protocol>://<user>:<password>@<domain>/<path>`. You may want
diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc
index bd9f345690..3979a142a5 100644
--- a/Documentation/rev-list-options.adoc
+++ b/Documentation/rev-list-options.adoc
@@ -1102,6 +1102,11 @@ It is an error to use `--missing-only` without `--missing=print` or
stronger than `--missing=allow-promisor` because it limits the
traversal, rather than just silencing errors about missing
objects.
+
+`--connectivity-check=full`::
+ (For internal use only.) Used by `check_connected()` to
+ select the connectivity check algorithm; see
+ `transfer.connectivityCheck` in linkgit:git-config[1].
endif::git-rev-list[]
`--no-walk[=(sorted|unsorted)]`::
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 0faa833fac..619855f4e4 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -29,6 +29,23 @@
#include "quote.h"
#include "strbuf.h"
+enum connectivity_check_mode {
+ CONNECTIVITY_CHECK_FULL,
+};
+
+struct connectivity_check {
+ enum connectivity_check_mode mode;
+};
+
+static void parse_connectivity_check(const char *arg,
+ struct connectivity_check *check)
+{
+ if (!strcmp(arg, "full"))
+ check->mode = CONNECTIVITY_CHECK_FULL;
+ else
+ die(_("unknown --connectivity-check mode '%s'"), arg);
+}
+
struct rev_list_info {
struct rev_info *revs;
int flags;
@@ -727,6 +744,7 @@ int cmd_rev_list(int argc,
int bisect_find_all = 0;
int use_bitmap_index = 0;
int filter_provided_objects = 0;
+ struct connectivity_check connectivity_check = { 0 };
const char *show_progress = NULL;
int ret = 0;
@@ -769,6 +787,8 @@ int cmd_rev_list(int argc,
if (!strcmp(arg, "--exclude-promisor-objects")) {
repo->fetch_if_missing = 0;
revs.exclude_promisor_objects = 1;
+ } else if (skip_prefix(arg, "--connectivity-check=", &arg)) {
+ parse_connectivity_check(arg, &connectivity_check);
} else if (skip_prefix(arg, "--missing=", &arg)) {
parse_missing_action_value(repo, arg);
} else if (!strcmp(arg, "--missing-only")) {
@@ -848,6 +868,8 @@ int cmd_rev_list(int argc,
if (!strcmp(arg, "--exclude-promisor-objects"))
continue; /* already handled above */
+ if (starts_with(arg, "--connectivity-check="))
+ continue; /* already handled above */
if (skip_prefix(arg, "--missing=", &arg))
continue; /* already handled above */
diff --git a/connected.c b/connected.c
index 34045f1032..0147b7d3b3 100644
--- a/connected.c
+++ b/connected.c
@@ -1,4 +1,5 @@
#include "git-compat-util.h"
+#include "config.h"
#include "gettext.h"
#include "hex.h"
#include "odb.h"
@@ -66,6 +67,27 @@ static int check_connected_promisor(struct repository *repo,
return 1;
}
+/*
+ * Fills in the --connectivity-check mode to pass to rev-list.
+ */
+static void connectivity_check_mode(struct repository *repo,
+ struct strbuf *mode)
+{
+ const char *algorithm = NULL;
+
+ if (repo_config_get_string_tmp(repo,
+ "transfer.connectivitycheck",
+ &algorithm))
+ algorithm = "full";
+ if (!strcasecmp(algorithm, "full"))
+ strbuf_addstr(mode, "full");
+ else {
+ warning(_("unknown transfer.connectivityCheck algorithm '%s', "
+ "using 'full'"), algorithm);
+ strbuf_addstr(mode, "full");
+ }
+}
+
/*
* If we feed all the commits we want to verify to this command
*
@@ -84,6 +106,7 @@ int check_connected(struct repository *repo,
struct child_process rev_list = CHILD_PROCESS_INIT;
FILE *rev_list_in;
struct check_connected_options defaults = CHECK_CONNECTED_INIT;
+ struct strbuf mode = STRBUF_INIT;
const struct object_id *oid;
int err = 0;
struct packed_git *new_pack = NULL;
@@ -133,6 +156,9 @@ int check_connected(struct repository *repo,
if (opt->progress)
strvec_pushf(&rev_list.args, "--progress=%s",
_("Checking connectivity"));
+ connectivity_check_mode(repo, &mode);
+ strvec_pushf(&rev_list.args, "--connectivity-check=%s", mode.buf);
+ strbuf_release(&mode);
rev_list.git_cmd = 1;
if (opt->env)
--
gitgitgadget
next prev parent reply other threads:[~2026-10-23 13:12 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 9:47 [PATCH 0/2] connected: add incremental connectivity check Kristofer Karlsson via GitGitGadget
2026-09-14 9:47 ` [PATCH 1/2] Documentation: describe connectivity checking Kristofer Karlsson via GitGitGadget
2026-09-14 9:47 ` [PATCH 2/2] connected: add incremental connectivity check via rev-list Kristofer Karlsson via GitGitGadget
2026-09-14 15:26 ` Junio C Hamano
2026-09-14 17:46 ` Kristofer Karlsson
2026-09-14 15:12 ` [PATCH 0/2] connected: add incremental connectivity check Junio C Hamano
2026-09-28 13:02 ` [PATCH v2 " Kristofer Karlsson via GitGitGadget
2026-09-28 13:02 ` [PATCH v2 1/2] Documentation: describe connectivity checking Kristofer Karlsson via GitGitGadget
2026-10-05 7:59 ` Patrick Steinhardt
2026-10-05 19:17 ` Junio C Hamano
2026-10-06 5:59 ` Patrick Steinhardt
2026-10-06 10:03 ` Kristofer Karlsson
2026-10-06 10:12 ` Kristofer Karlsson
2026-09-28 13:02 ` [PATCH v2 2/2] connected: add incremental connectivity check via rev-list Kristofer Karlsson via GitGitGadget
2026-10-05 8:00 ` Patrick Steinhardt
2026-10-06 10:37 ` Kristofer Karlsson
2026-10-06 12:08 ` Patrick Steinhardt
2026-10-06 12:36 ` Kristofer Karlsson
2026-10-12 12:07 ` [PATCH v3 0/4] connected: add incremental connectivity check Kristofer Karlsson via GitGitGadget
2026-10-12 12:07 ` [PATCH v3 1/4] Documentation: describe connectivity checking Kristofer Karlsson via GitGitGadget
2026-10-15 6:55 ` Patrick Steinhardt
2026-10-15 9:12 ` Kristofer Karlsson
2026-10-12 12:07 ` [PATCH v3 2/4] p5413: add perf tests for connectivity check Kristofer Karlsson via GitGitGadget
2026-10-15 6:55 ` Patrick Steinhardt
2026-10-15 9:14 ` Kristofer Karlsson
2026-10-12 12:07 ` [PATCH v3 3/4] connected: add transfer.connectivityCheck config and rev-list flag Kristofer Karlsson via GitGitGadget
2026-10-12 18:49 ` Junio C Hamano
2026-10-13 7:41 ` Kristofer Karlsson
2026-10-13 13:46 ` Junio C Hamano
2026-10-15 6:55 ` Patrick Steinhardt
2026-10-15 9:53 ` Kristofer Karlsson
2026-10-12 12:07 ` [PATCH v3 4/4] connected: add incremental connectivity check via rev-list Kristofer Karlsson via GitGitGadget
2026-10-15 6:55 ` Patrick Steinhardt
2026-10-15 9:51 ` Kristofer Karlsson
2026-10-15 11:50 ` Patrick Steinhardt
2026-10-16 11:50 ` Kristofer Karlsson
2026-10-19 7:30 ` Patrick Steinhardt
2026-10-12 18:55 ` [PATCH v3 0/4] connected: add incremental connectivity check Junio C Hamano
2026-10-13 7:54 ` Kristofer Karlsson
2026-10-21 11:22 ` [PATCH v4 0/6] " Kristofer Karlsson via GitGitGadget
2026-10-21 11:22 ` [PATCH v4 1/6] Documentation: describe connectivity checking Kristofer Karlsson via GitGitGadget
2026-10-21 11:22 ` [PATCH v4 2/6] p5413: add perf tests for connectivity check Kristofer Karlsson via GitGitGadget
2026-10-21 11:22 ` [PATCH v4 3/6] connected: drop dependency on `the_repository` Kristofer Karlsson via GitGitGadget
2026-10-21 11:22 ` [PATCH v4 4/6] connected: add transfer.connectivityCheck config Kristofer Karlsson via GitGitGadget
2026-10-21 11:22 ` [PATCH v4 5/6] connected: add incremental connectivity check via rev-list Kristofer Karlsson via GitGitGadget
2026-10-21 20:18 ` Junio C Hamano
2026-10-22 7:00 ` Kristofer Karlsson
2026-10-22 8:35 ` Kristofer Karlsson
2026-10-22 14:46 ` Junio C Hamano
2026-10-22 16:11 ` Kristofer Karlsson
2026-10-23 17:58 ` Junio C Hamano
2026-10-21 11:22 ` [PATCH v4 6/6] connected: add "auto" connectivity check mode Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` [PATCH v5 0/6] connected: add incremental connectivity check Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` [PATCH v5 1/6] Documentation: describe connectivity checking Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` [PATCH v5 2/6] p5413: add perf tests for connectivity check Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` [PATCH v5 3/6] connected: drop dependency on `the_repository` Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` Kristofer Karlsson via GitGitGadget [this message]
2026-10-23 13:11 ` [PATCH v5 5/6] connected: add incremental connectivity check via rev-list Kristofer Karlsson via GitGitGadget
2026-10-23 13:11 ` [PATCH v5 6/6] connected: add "auto" connectivity check mode Kristofer Karlsson via GitGitGadget
2026-10-23 18:52 ` [PATCH v5 0/6] connected: add incremental connectivity check Junio C Hamano
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ef572bc05d96fea05289191c6738751b704fbfb.1792761119.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=krka@spotify.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox