Article View: linux.kernel.git
Article #3066[PATCH 4/4] cat-file: report out-of-range reflog entries as missing
From: Caspar Duregger
Date: Fri, 13 Nov 2026 14:28
Date: Fri, 13 Nov 2026 14:28
86 lines
13586 bytes
13586 bytes
The batch modes of "git cat-file" report a name that does not resolve
as "missing" and go on with the next line. A reflog selector past the
end of the reflog is an exception: get_oid_basic() dies, and takes
the batch process and any requests queued behind it down with it:
$ printf 'HEAD@{999999}\nHEAD\n' | git cat-file --batch-check
fatal: log for 'HEAD' only has 3 entries
Pass GET_OID_GENTLY so that these lookups fail like any other. The
previous commits make sure that this changes only lookups that would
have died: selectors at the boundary or by date still resolve, an
emptied reflog fails gently as well, and a peel suffix after the
selector cannot resurrect the name through the reflog date parser.
Not every die() on the way is covered. "HEAD@{999999}~1" still dies,
as get_parent() and get_nth_ancestor() do not pass the caller's flags
down, and so does "@{upstream}" on a detached HEAD.
Reported-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: Caspar Duregger <caspar.duregger@gmail.com>
---
builtin/cat-file.c | 1 +
t/t1006-cat-file.sh | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 8870a210ec..56dea8eb80 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -627,6 +627,7 @@ static void batch_one_object(const char *obj_name,
struct object_context ctx = {0};
int flags =
GET_OID_HASH_ANY |
+ GET_OID_GENTLY |
(opt->follow_symlinks ? GET_OID_FOLLOW_SYMLINKS : 0);
enum get_oid_result result;
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index f2b24dd278..5fe2b4ad14 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -451,6 +451,41 @@ test_expect_success 'empty --batch-check notices missing object' '
test_cmp expect actual
'
+test_expect_success '--batch-check reports reflog entries out of range as missing' '
+ test_when_finished "rm -rf reflog-range" &&
+ git init reflog-range &&
+ (
+ cd reflog-range &&
+ test_commit one &&
+ test_commit two &&
+ test_commit three &&
+ # keep a non-null "old" side in the oldest entry
+ git reflog delete HEAD@{2} &&
+ git branch empty &&
+ git reflog expire --expire=all refs/heads/empty &&
+ cat >in <<-\EOF &&
+ HEAD@{2}
+ HEAD@{1970-01-02}
+ HEAD@{3}
+ HEAD@{999999}^{tree}
+ HEAD@{999999}:one.t
+ empty@{1}
+ HEAD
+ EOF
+ cat >expect <<-EOF &&
+ $(git rev-parse one)
+ $(git rev-parse one)
+ HEAD@{3} missing
+ HEAD@{999999}^{tree} missing
+ HEAD@{999999}:one.t missing
+ empty@{1} missing
+ $(git rev-parse three)
+ EOF
+ git cat-file --batch-check="%(objectname)" <in >actual &&
+ test_cmp expect actual
+ )
+'
+
batch_tests () {
boid=$1
loid=$2
--
2.56.1.windows.1
Technical Details
Message-ID:
<20261113142804.7465-5-caspar.duregger@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75386-linux-kernel-git=dewy.ruReferences:
<20260212040708.GA1894049@coredump.intra.peff.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75386-linux-kernel-git=dewy.ru
From: caspar.duregger@gmail.com (Caspar Duregger)
Newsgroups: linux.kernel.git
Subject: [PATCH 4/4] cat-file: report out-of-range reflog entries as missing
Date: Fri, 13 Nov 2026 15:28:04 +0100
Organization: Usenet Network
Message-ID: <20261113142804.7465-5-caspar.duregger@gmail.com>
References: <20260212040708.GA1894049@coredump.intra.peff.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1366076"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:hTDWlcg3+myTJJE3G8sQWCmmqiw= sha256:bhTNtZNUct+3R2HQSjMUQZmQ/Ma18qeoUmNz3Z1vxS8=
sha1:tkeyUoZNhK2mb5uTgHd0iCWpgyQ= sha256:+XFfNAhznUFmPCEp7/uLBPGIQsqL5ddcWbQgS4AKkCA=
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 9DBAF114571; Fri, 13 Nov 2026 17:50:10 +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 Etf0slmSOBIA;
Fri, 13 Nov 2026 17:50:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-75386-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 B229B114530; Fri, 13 Nov 2026 17:49:53 +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 1FC936E1025; Fri, 13 Nov 2026 14:29:37 +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=1794580141;
b=HfcBy3HpZG5/zC1jS2Wy+1CvrEVnXGsjLdQoesbTraoG3Riyw/0SGP4A+ihpm78cQV7l
7uuMpqQT6gycbwXiU0/HV3lhVy899SoDMXPgXtQ2FjOzRtXMzvEvxc8n6PRtBRlt3uz96
v2qkREvjT74hkpQSqRPkLv555ZdHQWOa261SFc2oaA/PH7MQFJmCqpX8qGniur37AOtNS
uaXt19HHSnHWeqYuusD366AJQJn5J6lWkaNrgC2bPxKpn95qseRAnz+rCiqQ5CHbnFV8/
UGTfxLBdgAw02BhHkBnJZuNBGDjZ0D2XT7FAf0WQF0Jo43yOiVXuNdwlXyXguX0fBJg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794580141;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=Z/DJOmhm2ZzMiU+QDF6O4bwo1ZzJihLPJ7zb84TmEuA=;
b=R2a/Ts5kZApJ73F2nr/JDpAlxq+pSmgF2TAEYMytPqz1HDNTtE6wcwMdiuL7PF2nbNZ4
jq6l5CT6d7sqdaRczM7PsF+gbHaD3/jxQ8yoMgXfAgpPuo72u2uORRGvZaq27C4Nf/Osq
Q6RYvrxidwn/7VZZFqwsb3T6NPzlRDAYycvVu6D4oX1vcaDLDXOJV8JekXWTU8D/oSird
DSsz9HfAoX2+2zUmAFW2/pGn515WjLZeS9QHM21D1LnnpYwG16aVJvq5tYCgWC8Hau5i3
Z3zHEquVHR/dHe+6L8sfLeZlv+wS5J29bao4uXbAtdynU/reV+LALOHM8mofk4E8fvQ==
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=TulDpUvR;
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 1EDFC606A887;
Fri, 13 Nov 2026 14:29:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TulDpUvR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794580140;
b=C0hEHP8ILEqNzPL0A27nvfCT2ElWFVE/9mUYCi8DvV/XVQSXUUgoeyPR7YxNbud07gc3
FofPsYZbryIdgSvY0fKJFZzwZU5DzK6nqCnEYHqxbLJza9+gXvPgH2/22POtZTeT83DP3
G9cUQ5swvar4Zv2QALc55TIdEN6n088kIKcNSiRgEWaeQ9kli3DMGXn0Agz3f7bFiFpDX
4KsFTPnZJEUgQvqVwX4RIMggh+HY6RRMLYEcoTdpGM2SESw5AWwqfME9Dc0AzrflznS8p
8GtPV3jdYq1RUhyxgp+s2SZFXYfOmFkA8oYnDILB0XANzRyFbGFA8C8LMdrfW1iMIkw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794580140;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=Z/DJOmhm2ZzMiU+QDF6O4bwo1ZzJihLPJ7zb84TmEuA=;
b=NXHvS3LQ3iVpaOPZICivzpX1Dm9WzL077mexhfgqGRmsXHM6sDsuiMDS+VL6XQNzTHcv
ehrdfExcxYf5gk3pCozx7GY7VWNhOZ624/ffo8EZM6eMf3Mxc7LAYqVXFz48OiIKDgEa4
i535zec2/tEU4RVx7vG+it1FEf01Nrn46Xj3YNKVl1FfEBblDMs0tbc9w6UYL51HA/Vbx
8n1IGoWHBKKkU8+irT/DkHx3dt1JGiTHuSYn1huMr6ButApwfXQK3RzufHJFp7NPuPx/O
fT/RcxwWoQEeqAzIz+gKFIgmrBYdg+4ynCNTugN8tnjpbPO+620Mveyq16q+XrnHA0g==
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=TulDpUvR;
arc=none smtp.remote-ip=209.85.128.53
X-Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53])
(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 E6B7E60A2610
for <git@vger.kernel.org>; Fri, 13 Nov 2026 14:28:59 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6B7E60A2610
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-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a2153c8525so6426855e9.3
for <git@vger.kernel.org>; Fri, 13 Nov 2026 06:28:59 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794580138; x=1795184938; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=Z/DJOmhm2ZzMiU+QDF6O4bwo1ZzJihLPJ7zb84TmEuA=;
b=TulDpUvRkaXo11y+X2CG8KXlo4ZFs0/429ULKEkiix+9Tu2OXf0R8mspTBJ2lDr5p3
xdxU5uNVsqWCybr79FN9eLvjaskuMiYtU8WPZuWr9hmIvfxtqS9ycCoogPQKDyZuU/dW
CXsWwNMhSLnyFjSPLw3nECkb8Zv0mQkXBRSXZPJqGLghjQd53QP1qDBw0GzBPRiqymUf
3ug0LEsJ8bhpvCUlXYJ9+PU0VX7HIgDAwuiN/Bmcd/CZdVvPVn6LSVGhetfQmSuOvGJO
HdDjcdRlM4SLK1LKXmENF+w/TZkQ2jyk8OnjrHpe6XXhf0A2XqauSXK4gQn4V6lvMyIY
iAiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794580138; x=1795184938;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=Z/DJOmhm2ZzMiU+QDF6O4bwo1ZzJihLPJ7zb84TmEuA=;
b=p13BKB0JX7xeLmDC5EHsTlRu2nrM+V/ixzZUKYKGcKHjFqGUhe5CtHRjyVDm6IlJ+l
kDKgUjfWVTx96nOQtBv+8omKwvqbcW+pIM/UDQZHPpJpeMRLK6vntLAI9uu4EDdij0f4
1ifqL55wcqFC8Z1DwkZLk3nFtpcr4IEjepG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f17b1804b1-4bb55aabdf9mr57868435e9.25.1794580138127;
Fri, 13 Nov 2026 06:28:58 -0800 (PST)
X-Received: from KURSA (ipservice-092-208-105-158.092.208.pools.vodafone-ip.de. [92.208.105.158])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb55ac1159sm60033285e9.4.2026.11.13.06.28.56
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 13 Nov 2026 06:28:57 -0800 (PST)
X-Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Junio C Hamano <gitster@pobox.com>,
Jeff King <peff@peff.net>,
"brian m . carlson" <sandals@crustytoothpaste.net>,
Caspar Duregger <caspar.duregger@gmail.com>
X-Mailer: git-send-email 2.56.1.windows.1
X-In-Reply-To: <20260212040708.GA1894049@coredump.intra.peff.net>
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