🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1482

[PATCH v3] rev-list: skip --grep argument in early scan

#1482
From: Azuama Odinaka Maximus
Date: Mon, 26 Oct 2026 08:30
69 lines
13005 bytes
The early option scan in rev-list does not account for options
that take a separate argument. As a result, a pattern passed to
--grep can be mistaken for another option.

Skip the argument to --grep so that it is not interpreted as an
option during the early scan.

The tests check that patterns beginning with "--" are actually
matched by --grep, including when the pattern resembles an option
that the early scan handles specially.

Signed-off-by: Azuama Odinaka Maximus <azuama69@gmail.com>
---
Changes in v3:
- Improve both regression tests to verify that --grep matches the
  expected commit when its pattern begins with "--".
- Add a blank line between the tests.

 builtin/rev-list.c          |  2 ++
 t/t6022-rev-list-missing.sh | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 0faa833fac..453d82d25c 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -771,6 +771,8 @@ int cmd_rev_list(int argc,
 			revs.exclude_promisor_objects = 1;
 		} else if (skip_prefix(arg, "--missing=", &arg)) {
 			parse_missing_action_value(repo, arg);
+		} else if (!strcmp(arg, "--grep")) {
+			i++;
 		} else if (!strcmp(arg, "--missing-only")) {
 			arg_missing_only = 1;
 		} else if (!strcmp(arg, "-z")) {
diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
index 1bd2c3bc4f..3757bde708 100755
--- a/t/t6022-rev-list-missing.sh
+++ b/t/t6022-rev-list-missing.sh
@@ -215,6 +215,26 @@ do
 	'
 done
 
+test_expect_success "--grep accepts a pattern beginning with --" '
+        test_commit --no-tag --missing-only &&
+        commit=$(git rev-parse HEAD) &&
+        echo "$commit" >expect &&
+        git rev-list --grep=--missing-only HEAD >actual &&
+        test_cmp expect actual &&
+        git rev-list --grep --missing-only HEAD >actual &&
+        test_cmp expect actual
+'
+
+test_expect_success "--grep does not trigger --exclude-promisor-objects in early scan" '
+        test_commit --no-tag --exclude-promisor-objects &&
+        commit=$(git rev-parse HEAD) &&
+        echo "$commit" >expect &&
+        git rev-list --grep=--exclude-promisor-objects --missing=print HEAD >actual &&
+        test_cmp expect actual &&
+        git rev-list --grep --exclude-promisor-objects --missing=print HEAD >actual &&
+        test_cmp expect actual
+'
+
 test_expect_success "--missing-only requires --missing=print or --missing=print-info" '
 	test_must_fail git rev-list --missing-only --objects HEAD 2>err &&
 	test_grep "requires --missing=print" err
-- 
2.53.0
Technical Details
Message-ID: <20261026083055.18873-1-azuama69@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-73267-linux-kernel-git=dewy.ru
References: <20261021172458.6373-1-azuama69@gmail.com>

Show 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-73267-linux-kernel-git=dewy.ru
From: azuama69@gmail.com (Azuama Odinaka Maximus)
Newsgroups: linux.kernel.git
Subject: [PATCH v3] rev-list: skip --grep argument in early scan
Date: Mon, 26 Oct 2026 09:30:54 +0100
Organization: Usenet Network
Message-ID: <20261026083055.18873-1-azuama69@gmail.com>
References: <20261021172458.6373-1-azuama69@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1262100"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qnTH/0qtYOXFttegaGU9ZDNdV68= sha256:Zs7kLrS1OwzhVU/wSRuTMuKVtJ54yPj/DjeiX4vAsKY=
	sha1:NFzGE/v/FrwS9p78yEfHPOfT3dU= sha256:GKqDBcF8xDbc5ypdKXqtSahcbaIytvvvSh00z9UgJjw=
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 7F8CD125B8E; Mon, 26 Oct 2026 11:35:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.948
X-Spam-Status: No, score=-1.948 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, 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.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-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 psFeuhW4DDuP;
	Mon, 26 Oct 2026 11:35:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-73267-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 1EFD5125B7B; Mon, 26 Oct 2026 11:35:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id B0E0223510; Mon, 26 Oct 2026 08:35:25 +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=1793003724;
	b=dwQ1f4PMsflKUq7hZEKC4b8Ova+ENCwbBt57Mzpj3N8CLnlXwPZtd5tk2Teq4nuMqaPQ
	 k7GBfAVtvS74lxUIA42fer0kX4sIoKIxoKz6bpe/pGpQKtha4m47ZuYxOj+rAvneqdavm
	 x6flr7WPlaesKF3sSAF85obac27YZi3F74UgP4o7YU2Y6De4oWKRlaOq4ZTurWpQPphNc
	 W1OdilLzwdYLZ7y/3qiyZDDYT0wM6EHDur6sIr93R+ciljDIv9LnE/2sr/Q5cbmzIz+MU
	 xc76NauSRHNKBiWpfOEARSANDxbHWnjOM7aFWwbq5j0bIRg3kCiVZ/1ZGgVTikBcYkg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793003724;
	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=5UejlZU6ZGv6wFOZIdLwc0cmbg1ulws0Y3doh33b+L0=;
	b=3+fuOzxlAyY+e+QVjd88qI2IBLQ9jj8CVYfg7vT/AUjPdwygCN7sGC87+KGfPlu2LIfl
	 EbwkIIPQFsWIhb9H/1SYIi+JwY7bWLHnykh9XSbva/hqfaEbOO/GtbvqxaSWDUU/5Wxrj
	 X6Vh9GVQJJ7UTFATpZXu7TkA4u7iaY3DVkCvDF9qSnHVYzsxR6ldOswtH86hISe0dL5hf
	 sz4ONJfHvwI8ahSVkEHJmePuFVxQU1/kCjzvUSIdnkcSt4Pr8Dvur0gO9Ed8hduFDXIH/
	 GA0YU+37LoDhIPYfimQe4FR6wd5jk9iIGye5KIAA9XJ0JJOFo6YY6csMIJBvJNgOkxw==
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=20251104 header.b=Jnm+VoUu;
	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 0E03B606A321;
	Mon, 26 Oct 2026 08:35:24 +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=20251104 header.b=Jnm+VoUu
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.42
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793003723;
	b=1yWhGGZPQcbnAEv9zSA2eef6dD3v1WoNG13ApxWFOGWY5KEPrUZ6qTiZLAzYLxd2Y3cl
	 PfbVCxztohO2sUpS9xESkGy2E0c6EOLiRqf5lYa2oxx7koGbUsFlIocGsybgENnrvaxp8
	 afTMGVtMybmnETPdnkHuRq4cck98rhyOL1gxK+sXOD1aPo/ky0hfL1KOtx+nihdZbnHOD
	 YhhlGrLAZZzNIRRXUCJEW4bLOmQoEJRACq0FaPjjJd/viw70o7RhmKVpzV1eqgQWGt73S
	 7vFVS9LZa+/A72J95thKxKoQ2ZRfM1tqnlweF5q6Fa498+cNw3n3uSB068o0Hh8jyRA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793003723;
	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=5UejlZU6ZGv6wFOZIdLwc0cmbg1ulws0Y3doh33b+L0=;
	b=kn5r/AkqoYeJNPvB8on4HoLJpw+WxJHU12+XeyhOmakeS6ZLlRwhFCLXnoD4Pu5TT5Nb
	 S4RPROagUXeGvUM0o95tXbp4U2AscAlk1UxwvUQu1dd6FF74cUwH0tAyOF7bcHe17ciBd
	 3WkxH1XzzFuq4LV50PtTYGMLLaHzRRrFoIs6RMIQrpbr3POhw41c+MwUj/OuS+0HaZKyu
	 qxWfOLtkGWhnJE2L19P9Z8m8JWVaxjk5kBhykV370JDOVpAAPL2Ddm3MiOIN2uqCrAW+Z
	 CxheHX2d+0EIiQnKMwllFNUy5kOAS8+opNMQArBv/OJJzbArmnuSlUVB0LO89fowAxg==
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=20251104 header.b=Jnm+VoUu;
	arc=none smtp.remote-ip=209.85.128.42
X-Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42])
	(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 C7F3B606A31A
	for <git@vger.kernel.org>; Mon, 26 Oct 2026 08:35:22 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C7F3B606A31A
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-f42.google.com with SMTP id 5b1f17b1804b1-4a3517554f7so16584175e9.2
        for <git@vger.kernel.org>; Mon, 26 Oct 2026 01:35:22 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1793003721; x=1793608521; 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=5UejlZU6ZGv6wFOZIdLwc0cmbg1ulws0Y3doh33b+L0=;
        b=Jnm+VoUunQwWN5/tw9SW3wA4p9xTvB5cvfkwqv+h9GxKB16slle7cBBr/1FWVe1XCj
         uEYtdFb7guhzmhEGHePOppJcwzTgmwsX/Q5IE026y4FOcMBeUhHHI3EAVtVM604e3hS/
         RcJzRt8UAaIeMNMJunISslX9x7KChvllqKJKk9IA2BwptYGjS1sthtjHg27dslE8QrcA
         hI9UiwkqjN6+bG/pz1AoA/PeTn+H7k8Rx3GwkEXFaDW3VoWfzuwZzslcvp9ZelJvZ1I0
         k4vFY8V2kuocyQI0bi2CB7m2Hu00m/1xEthAAgbTIFJhfOSWt5jQWO/rpZjKYHnMJofR
         BoSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793003721; x=1793608521;
        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=5UejlZU6ZGv6wFOZIdLwc0cmbg1ulws0Y3doh33b+L0=;
        b=H4rnq4bqr/xYNPwfgxPMFmfj1K9H38xiwJ0yuY3I78MXu4i8snkcTpVqlahCj5v3wd
         MSn8QMxQf/63hOvYKeKf3Rm3/fh66WrtBlKlj2930Z98GSOHp162K69+q6R4dsrh4vrI
         sSViPyGKpUBtuF/wTmJBTINDK9B4obVpspa5k35uO0Z6O4hPQJAcSzLajF5vHsH/SyPa
         nRP1Op/dCAfZTiOtPjPULUDlWWoTAljPqMgqXzSFnl6tMGzo/lf5QOyCOtcIkYn51/TC
         TAk9Z0cS+QDF7nY1pEUdxTVgYlgw/vWiG4zLjRTiFkGDrl2ok1M8AxmgpL40SuOh8bQA
         Iinw==
X-Gm-Message-State: AFq9FYJAv09SaSxwnGxSVpNWtW2wI4yfYtMWIUneYFkYSxR1i6yJ3a5P
	ZSgH7YoIek97Pxx6F4B5o7Gp0m+nF+nwlaTXbJSeoaoP8Y0TNnbEJpLb287tjq6H
X-Gm-Gg: AYBFou1yBqG7/CEHgAszXNceAg1Jx4VTKmhhA/8//soekQrS0j3dQh2+TiEOtWu/q9T
	C3WRk935Nz3rLAPaBFOemlriF4plwApRBCsBx9e10/CWPPzAde2W66LtSKeCGFZLzkp9gQX1EHJ
	7DXL3gQKcpow8LnqrUWTD3NrMRHObP7/AMq1b5ieUkDlIhvDDMOo+Ie9H5R0Qlt1qOx4dNLeedj
	SPAzWeYlLEmzT/M50qt/EjrNZw04VxAUzsJTBk+ffNpt9NFnTRFfrROMD5NqU/YvlplCvr9d2m6
	QmiFnWHPR89rAGGa5Nc2DEmstGTI2YPFs9yJUNKapwQdhaxULDbluIdkQKOQjcQr6MpKN+rwoVh
	drqoP/XPKKPNuEEvMn/B7C5hmtVZva/qPLAzqAZnV3iPJFHSgx4HQP81TQCkg9wm8pPlHQEwdMd
	+c6aK/RriPOkBaqf7oQVgShyo04jZ1L1QkVaQDa5hg8Qo53zftxh5pJ/R14LweCRV+p7GdYe57O
	tbfsCzJUzRoi9JzbK2j/apiUdKoMkgQ0jzwRwck/6DUXY2/41IGcjwMN+eUt2scR43sQhSh5TK4
	VeIKtl/dPAqmCYc=
X-Received: by 2002:a05:600c:c16b:b0:4a0:b6:4619 with SMTP id 5b1f17b1804b1-4a35aae873dmr110595205e9.0.1793003720691;
        Mon, 26 Oct 2026 01:35:20 -0700 (PDT)
X-Received: from zito.localdomain ([102.88.168.39])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a359fbb725sm177475635e9.0.2026.10.26.01.35.19
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 26 Oct 2026 01:35:20 -0700 (PDT)
X-Cc: azuama69@gmail.com
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261021172458.6373-1-azuama69@gmail.com>
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