Article View: linux.kernel.git
Article #2151[PATCH] rev-list: ignore replacements in the connectivity check
From: "Kristofer Karlsson via GitGitGa...
Date: Mon, 02 Nov 2026 15:47
Date: Mon, 02 Nov 2026 15:47
151 lines
16965 bytes
16965 bytes
From: Kristofer Karlsson <krka@spotify.com>
The connectivity check follows replace refs, but other operations
that depend on the repository being complete, such as fsck, prune,
pack-objects and upload-pack, do not. They were taught to ignore
replacements in dae556bdb1 (environment: add global variable to
disable replacement, 2009-01-23), as they must work with the
original objects, and check_connected() came later without doing
the same.
Teach the connectivity check to ignore replacements as well, so
that it verifies the same objects that the commands relying on its
result will read. This is not a problem seen in practice, but the
two can disagree. If a replace ref names an object that is not yet
present locally, the check follows the replacement instead of that
object when it arrives, and accepts an incoming pack that lacks
objects below it. fsck and repack then fail. Such a replace ref can
be the result of fetching refs/replace/* without the branch that
contains the replaced commit, which fsck does not complain about,
but it still takes a sender that sends an incomplete pack.
check_connected() passes --connectivity-check to its rev-list
subprocess, so make rev-list disable replacements when that option
is given, for both the full and the incremental check. Also drop
OBJECT_INFO_LOOKUP_REPLACE from the object reads in tree-verify.c,
used by the incremental check, to match. Disabling replacements
already overrides the flag, but it suggests the opposite intent.
The t5413 test that expected the check to accept a commit whose
original tree is incomplete because a replacement is complete now
expects a rejection, and the test that disabled replacements
explicitly to get one is redundant.
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
---
rev-list: ignore replacements in the connectivity check
I noticed this while working on the incremental connectivity check [1].
I could not find any discussion of why check_connected() follows replace
refs when fsck, prune, pack-objects and upload-pack do not, and the
history suggests that it was never a deliberate choice.
This is meant both as a question and a proposed patch: should the
connectivity check ignore replacements like those commands do, or is
there a reason for it to respect them? If there is a good reason to keep
the current behavior, I don't have any issue with dropping the patch
directly -- you would not even have to look at the code :) If not, I
think aligning them is a reasonable thing to do.
The case described in the commit message, where the two disagree, is
tricky to trigger in practice, so I do not expect it to be a common
problem. The main benefit is logical consistency.
Shallow boundaries are not affected, since they use the graft mechanism
internally, not replace refs.
[1]
https://lore.kernel.org/git/pull.2211.v4.git.1792581744.gitgitgadget@gmail.com/
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2279%2Fspkrka%2Freplace-connectivity-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2279/spkrka/replace-connectivity-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2279
Documentation/rev-list-options.adoc | 1 +
builtin/rev-list.c | 3 +++
t/t5413-connectivity-check.sh | 11 +----------
tree-verify.c | 2 --
4 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc
index 285fb3809f..b2c0d394ab 100644
--- a/Documentation/rev-list-options.adoc
+++ b/Documentation/rev-list-options.adoc
@@ -1107,6 +1107,7 @@ It is an error to use `--missing-only` without `--missing=print` or
(For internal use only.) Used by `check_connected()` to
select the connectivity check algorithm; see
`transfer.connectivityCheck` in linkgit:git-config[1].
+ Replacement objects are ignored, as with `--no-replace-objects`.
endif::git-rev-list[]
`--no-walk[=(sorted|unsorted)]`::
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 071a0e3cb5..bf66d2c9ae 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -30,6 +30,7 @@
#include "strbuf.h"
#include "tree-verify.h"
#include "parse.h"
+#include "replace-object.h"
#define INCREMENTAL_MAX_COMMITS 1000
@@ -807,6 +808,8 @@ int cmd_rev_list(int argc,
revs.exclude_promisor_objects = 1;
} else if (skip_prefix(arg, "--connectivity-check=", &arg)) {
parse_connectivity_check(arg, &connectivity_check);
+ /* Check the original objects, like fsck and pack-objects do. */
+ disable_replace_refs();
} else if (skip_prefix(arg, "--missing=", &arg)) {
parse_missing_action_value(repo, arg);
} else if (!strcmp(arg, "--missing-only")) {
diff --git a/t/t5413-connectivity-check.sh b/t/t5413-connectivity-check.sh
index 60edf99b63..341638a433 100755
--- a/t/t5413-connectivity-check.sh
+++ b/t/t5413-connectivity-check.sh
@@ -427,18 +427,9 @@ test_expect_success "$mode: handles directory-to-file transition" '
# Replacement objects.
-test_expect_success "$mode: accepts with replacement objects" '
+test_expect_success "$mode: ignores replacement objects" '
(
cd replace-test &&
- check_connected "$original_oid"
- )
-'
-
-test_expect_success "$mode: rejects without replacement objects" '
- (
- cd replace-test &&
- GIT_NO_REPLACE_OBJECTS=1 &&
- export GIT_NO_REPLACE_OBJECTS &&
test_expect_code 128 check_connected \
"$original_oid" 2>err &&
test_grep "missing blob object.*$orig_blob_oid" err
diff --git a/tree-verify.c b/tree-verify.c
index 25db76d30b..c228235150 100644
--- a/tree-verify.c
+++ b/tree-verify.c
@@ -133,7 +133,6 @@ static int verify_blob(struct repository *repo,
vs->blobs_checked++;
oi.typep = &type;
if (odb_read_object_info_extended(repo->objects, oid, &oi,
- OBJECT_INFO_LOOKUP_REPLACE |
OBJECT_INFO_SKIP_FETCH_OBJECT)) {
if (vs->exclude_promisor_objects &&
is_promisor_object(repo, oid))
@@ -163,7 +162,6 @@ static int read_tree_object(struct object_database *odb,
oi.sizep = sizep;
oi.contentp = bufp;
if (odb_read_object_info_extended(odb, oid, &oi,
- OBJECT_INFO_LOOKUP_REPLACE |
OBJECT_INFO_SKIP_FETCH_OBJECT))
*bufp = NULL;
if (*bufp && type != OBJ_TREE) {
base-commit: ebdc087dc99d68bb340c282b2ba5f722def28d19
--
gitgitgadget
Technical Details
Message-ID:
<pull.2279.git.1793634429929.gitgitgadget@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74185-linux-kernel-git=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74185-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Kristofer Karlsson via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH] rev-list: ignore replacements in the connectivity check
Date: Mon, 02 Nov 2026 15:47:09 +0000
Organization: Usenet Network
Message-ID: <pull.2279.git.1793634429929.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2976262"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:d5BYNwB6BT2TaNXcIummS7sXpRY= sha256:KYCW1d0DnpBuq+u93ooIxNbURqja07bZCkafLyjEmSg=
sha1:bntZrBz9BtPzUK/F7ZqfQAG4Lss= sha256:1+Ij9SW+rswXX8CBVyL4S1CE7GBU7uzm+Mm5/YewKLg=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id E51BE1125B2; Mon, 2 Nov 2026 20:02:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.148
X-Spam-Status: No, score=-3.148 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id NOvCjIu6UVP4;
Mon, 2 Nov 2026 20:02:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-74185-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id C67FB1125AE; Mon, 2 Nov 2026 20:02:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 55CB560EE8F; Mon, 2 Nov 2026 16:50:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793634433;
b=dYF5wWkPNa3hdUgnfkkzM7VNdgtKdhELvCIVZDXBulAWrEvGZw1mmSM6e7x5cSgPopLn
KB86Ve/C5Tyc6MbfA6MRHHI+0C+1HDPRoHhlOgEpNitDKfV4TJOw0mjJZMnSMAacXuTSQ
AW7fDVDp5Qx62ryuIyWWtUdOQMdJ913nwGc4X4HzRDTg/6Bda9L4ZotNrqv4mw4YqTqkV
Mh22DXqp/sVtaMB0c0YBD5vkfCC7di0MBuu8UGY+THguqj+h6EX1OtWJXC5HofYK9Nj6w
jqn2q/An6qtpvAZbRsjrv/BSa7aD5Asm16cUP+pwLQkSk1BGeV0cJ+hTf4Bl53EKXuQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793634433;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:Message-Id:From:Date:Subject:Fcc:Content-Type:
Content-Transfer-Encoding:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:To:
Cc;
bh=jThK2Ymz2zBpawwoBpSbv4iASXlAqUaFi596o0k5hiw=;
b=Jw5TJ877ayX3WMs6Ad8jXAxV9HGpesjJ79rnGDWuQDdYPs6JArTwIZnb7L0FKIsLS0E6
tx6QgpEMRdFyvEvNCYBK5wR03a8Tpw8b7RtXAyoYIftjKPquYdnz/05hxkaEjsrxpSHy0
OOcJbZN26JNTDluvsnblz7ML53hLCBMd8m6gYsjmu4N37eBmnDNdBm1J/iOPonNJp1d9H
8Fh3sf72I1pkwXIrjKY9rUAsGjZdkpXa88zg7QQx8m/n5xK74WnexBtRHK8ahQvZmmagI
FckI46J50LfLbk2uHFRObJ0zKzVB3nOKMfJF+s2I0z1wvvD+1ItMxPADyj18Gk4RlHQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uOrovgDh;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 915046074668;
Mon, 2 Nov 2026 15:47:13 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uOrovgDh
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793634432;
b=yM1HOkq1gXUrq5g84mXfC+6szNPVXS+1p+VUijs0oWd3CMk9BbrDdv8zU+YeSbsb1EkX
0Bp5bOYH5rFYgLHcbi21VZIQsTj3zwGdx50BucLkc3R6GuQicCdjiL6jOmSBtzxLrZy/U
c/+L+rk+OdD0EPhdeuo1VWlm/92CEj0TIgOXOcj3SOAcJYUobhCDYHbQMTkkfsc4UpEL8
BqFnSuUqiDLlIpEuXEPJuQw1Yjw23ghhpGzz5Y/4y1TN/bHe+HAQ0uTah70ZgjYLRhSh+
Asb57goaTjwNv+/m8fTgApx6R/LN2g3DxkRQoylpnvmjScIevCOoaFNM2qekc7gtkQg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793634432;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:From:Date:
Subject:Fcc:Content-Type:Content-Transfer-Encoding:MIME-Version:To:
Cc;
bh=jThK2Ymz2zBpawwoBpSbv4iASXlAqUaFi596o0k5hiw=;
b=sA58f9SzxuYiMpZp+TscQYhj31RWVXsB1hjc5M8NhkdcTA0GU9jdu5IIs4BiyoQYO2QC
1X4Yqz8H/T8j7KejXFelmJ+9jsZV3bHkIrR0gRxvIbgRN0jIhzjU/5K0ug8ZgXP0gACYL
Ef2HISJryLUQ/z/xcfmJBXtozG2QhZNkRnR9PMfdTKW8uIeewCgkUvY2PtHVbX9vkPBGh
dlKavA8PnIgC7nTZiHxlCr6Z9fqpJCQDHck7viEGVtJHS5r6BWsEqX4V6BEwzdCM82Fc6
8986Q12qj1JfIZgdeOcxgVEOlI+ZqBTYO2BIJqWGMR/wB6BBSX5OBDuhMahYkHshJtg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uOrovgDh;
arc=none smtp.remote-ip=209.85.160.54
X-Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 571E7606B1D9
for <git@vger.kernel.org>; Mon, 2 Nov 2026 15:47:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 571E7606B1D9
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-4a6fb4040cfso946439fac.3
for <git@vger.kernel.org>; Mon, 02 Nov 2026 07:47:12 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793634431; x=1794239231; darn=vger.kernel.org;
h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
:subject:date:from:message-id:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=jThK2Ymz2zBpawwoBpSbv4iASXlAqUaFi596o0k5hiw=;
b=uOrovgDho2XtprjWOZ1m7dzXfCDVD0KPL5/4+dxBSWlMzeMOr2kBCMXqFfQ9HC+Faw
hV6LO4KMEg1KVfycACVNAzbZ1AJx2x4QKspK7PhviHPXiFpmCGRCCLC+iZfUzWypHEFB
uzzwu6ib0ZQfs9tGWpenqm3pdru96mi6W5BeYAxl1SE5/gnhPKke6h/o9hatDwoKG458
j5Nwwau/FO6I1kMFntEj/zxVN5N2pq0oxlX3K5I1iL71/IEnnMAVQY0VEgKq/GbJTQAc
bl1jsrMQka/MQXZND9J9v97Kc3Yo2JWI9GWo7hkrnAhi6mQebqyyQ5+xT/AWt7GfuG1V
2t2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793634431; x=1794239231;
h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
:subject:date:from:message-id:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=jThK2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pjSvu7LCW/Hw8ZbDdJOEI65v+H8Sfu5DaozOdInQui12QQHPiOB2DAQcSAZgDFJm/0
aCqqcEzATokExDg3C8hVqoNQaD3905peDko+TKatrF9A8CPNcf4e
X-Received: by 2002:a05:6870:16f1:b0:48f:e0f6:c45e with SMTP id 586e51a60fabf-4a907722e6fmr5884015fac.44.1793634431089;
Mon, 02 Nov 2026 07:47:11 -0800 (PST)
X-Received: from [127.0.0.1] ([20.118.38.99])
by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a92167b03csm6858589fac.2.2026.11.02.07.47.10
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 02 Nov 2026 07:47:10 -0800 (PST)
X-Fcc: Sent
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Cc: Christian Couder <christian.couder@gmail.com>,
Kristofer Karlsson <krka@spotify.com>,
Kristofer Karlsson <krka@spotify.com>