🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1064

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

#1064
From: Azuama Odinaka Maximus
Date: Wed, 21 Oct 2026 17:24
49 lines
12275 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.
---
 builtin/rev-list.c          |  2 ++
 t/t6022-rev-list-missing.sh | 11 +++++++++++
 2 files changed, 13 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..180e6ac766 100755
--- a/t/t6022-rev-list-missing.sh
+++ b/t/t6022-rev-list-missing.sh
@@ -215,6 +215,17 @@ do
 	'
 done
 
+test_expect_success "--grep accepts a pattern beginning with --" '
+	git rev-list --grep=--missing-only --max-count=1 HEAD >expect &&
+	git rev-list --grep --missing-only --max-count=1 HEAD >actual &&
+	test_cmp expect actual
+'
+test_expect_success "--grep does not trigger --exclude-promisor-objects in early scan" '
+    git rev-list --grep=--exclude-promisor-objects --missing=print HEAD >expect &&
+    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: <20261021172458.6373-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-72748-linux-kernel-git=dewy.ru
References: <20261021151253.3689-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-72748-linux-kernel-git=dewy.ru
From: azuama69@gmail.com (Azuama Odinaka Maximus)
Newsgroups: linux.kernel.git
Subject: [PATCH v2] rev-list: skip --grep argument in early scan
Date: Wed, 21 Oct 2026 18:24:57 +0100
Organization: Usenet Network
Message-ID: <20261021172458.6373-1-azuama69@gmail.com>
References: <20261021151253.3689-1-azuama69@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="18283"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:t0L2YMa5lpvrLy1B4SscxHjWung= sha256:qp0xxXFX2ylfqWwJdsS1joZPcPVtDrqzOZ/+st4MkSY=
	sha1:3nKNxZuk+lTVzRnQ5KUbNhc9X7Y= sha256:/mqxMUO2qvJ/vc4f6WW2/Ci5KFFFZuCWCCjnSnvFwpU=
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 34BA51110B8; Wed, 21 Oct 2026 20:26:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.047
X-Spam-Status: No, score=-3.047 tagged_above=-9999 required=6.31
	tests=[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, 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 G6iNCvl_vDNR;
	Wed, 21 Oct 2026 20:26:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-72748-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8BB511110B2; Wed, 21 Oct 2026 20:26:13 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id D38372FEDA; Wed, 21 Oct 2026 17:26:11 +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=1792603571;
	b=PkuiLIbbNJOPOMeQoF9u/GXgv4hewQC5y0ckh1CyUS+w9ovyzrHwKAxu1sITCdj7eQz/
	 XtCeKbTnuI51YEg6dNZRNjSiJUjtDS3Io7cC1teh/ZAzrCVZC8jO2hX2alcfpWjeqGSS7
	 m9TfKS8OHd507/ZzWkESBVUF7WEB2dvXAmxqoQPHuSgFz9pFocr4f9si3Z0zMIVU+y+pG
	 Csbt2kagUVvOpxtqFoCzvB6tsLFzwWR2xoB1ggYqJJ9nbJiuBJavfvHRW59L0RHuGY8/h
	 1n7GruTEeLhgvc2Uumfqf5A25wH/CF5RP8sOXKqHa99sC3fFA0eF8NeKhRhXJKXmNPw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792603571;
	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=zSXQR98bnaEr1r6UttuCJhq0FSSU0soGDYzSA9IFopI=;
	b=1lWZVv5btYMnI7QqZosm3/85rbzuzYdrr45xCDLcPsO7A1/CqNWe3XEBRTQaJEGFEmTa
	 Y7WuXNYSdbF10kEcjtH+TYI5UKEGrdSVZU9jA7UpgsSOLz/ez40cHeFcn72WHh0Uu4nyS
	 Q5VmGbF8WyxFIbvpxZzljWlo99Omayf8SKSZdaVKsXb+qV+3I4udgMMrwUUZjIizBcT0d
	 E7GWHfRW49wSQ6Bl6VpCVrVj/AKrf3rgEslcv2lE37SxewyrK3zQr0BeEWHFoCYnHpUry
	 Dcvir46dGi/Qv3LhnPa5d1UVmbEvwhTFtuyVIhCUgS+nd5gw/Fq52o8WMUjGpLytMdA==
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=Qy4Sj40Z;
	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 5433B606A31E;
	Wed, 21 Oct 2026 17:26:11 +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=Qy4Sj40Z
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.43
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792603570;
	b=4v/w0qdTQxVyMUSxeJ71WwKvDCFQbGblY936WSeUPkB96G6RppXrOhwg7l+huvAKxbOz
	 cyh4rWLUxPT7CTyj2sQqw7nCU4LEKkYkvvOeSnlRm2Lnj0t5Qys2zHa+D9N0YXusIwrq3
	 UJH8dzuSIhiik+Kh/b4UGesBTRLD+KBOI297voHgror6Pz2OovpS85YnIdVTnOPD9XOWS
	 68D6qBT0NiQUYuLxUC0ysxvyjW/66iRmWaDGQukYEOzmOVbbnCiTQepTam/3VTqSAbbO7
	 97bDA+4N3HszwiZtHwXL0aiiKrjh592PfkfanDpfLc3Ddb+Imz5SeZxTqZVilJqJqEg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792603570;
	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=zSXQR98bnaEr1r6UttuCJhq0FSSU0soGDYzSA9IFopI=;
	b=t82zxxd8FEm4Zowv92XmsSTT4M/FDA39pkLtQhWuEomqGS4DY23cjJGYUMCcfR5VM/Pt
	 j0bA4DJd5ZjbpQA+WyNyOHyNz29wa2v+bHN3YtsK7c6n4uam1H7i/QODQPywJWZ0O0GFZ
	 dGj0PAGMU/+PILhJqOqr6Y2y13QC1nYnuofPPvwtcbWNmNMMEyremDwW4zZ4C8HDrExR1
	 +ix+4AoOLJqbDj3e7mvgev4m9KP5aoVGzg81JPm5LfDx5EpoBCfo/VCK0qPGpHX6Y93GT
	 FVUKSEtNkwfM2poaUqucXsb7LMZqdaY+6sJlusuiosnAkbcxa8ZeZXEf2EcMYzrj50g==
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=Qy4Sj40Z;
	arc=none smtp.remote-ip=209.85.221.43
X-Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43])
	(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 1B5DE606A31F
	for <git@vger.kernel.org>; Wed, 21 Oct 2026 17:26:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B5DE606A31F
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-wr1-f43.google.com with SMTP id ffacd0b85a97d-48afbd2c386so745821f8f.3
        for <git@vger.kernel.org>; Wed, 21 Oct 2026 10:26:09 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792603568; x=1793208368; 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=zSXQR98bnaEr1r6UttuCJhq0FSSU0soGDYzSA9IFopI=;
        b=Qy4Sj40ZUG+Ap89dVfvA91YOGO97MNTKbMn2G4ByQCRUwKi3T2L8RLqMBcNAsXaSEB
         4WqdnkyhqSBruun6AoJ9Zc+rVs71NsW1lRy7ohLWWhCPzcpnyrPnQXtlA1vyTM9m/R0c
         GMsPzZZf7Sc67ZpJEpzwHuQO/0j1APyNtuhqIa/p0xgQJprWvbUeUEPMAvdrpgzZOCpQ
         keFrzDCMhRSDP8W+5UJRnKfu8s7MEeTi/zUuXC9CwfmwdMf26uyS8PiAi5BMk0yKSPuL
         EsinejF4pUaStupgyuG2WaMUmf5PIrYGMRzNxq7byysyDBhQsE30mJ5OjCP5buvpnbjY
         pIrg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792603568; x=1793208368;
        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=zSXQR98bnaEr1r6UttuCJhq0FSSU0soGDYzSA9IFopI=;
        b=2djbsK4EFa5W+Fs9YBMlc6lwTkoEkx+90PwLnVCG/iDBonKaycZmrEGVOBIm8d5jNC
         +V2nSMCOwu4I2xli0cY851Ht9NtVh6gXENzPmf4njnnpSJaBqJsdCHRt4qJedCNy7krt
         FNuefmu0I+bgyi6uZxhsXAlcYtWu+j2ikZHinTUeqhguSpkU2liRP/tFE41RILfS1pCY
         XMjcGOVlQqeUMM/EZMK2IlS/wi8Y3tIOaKnXDLv/pm0WSeJ5Tn3s1dIS/aYjMqsGH3xO
         RnrRM3EBppXx3W3zBBtwcbKRkUN5yrKSHzq05BZgu5ZGKT+/PQoTj805gfJHtzpx2YhY
         tOLA==
X-Gm-Message-State: AFq9FYLXPURq19EU48fDLkGNKyG5GAToETAKsPaUvM3bFqPULpf5M97h
	YO0N6ViWHeC0UL/0eGtJv5WrFpKyRSSA3+rbVyKJjkC+gvoT66on4IltdKjE+Z20BNA=
X-Gm-Gg: AYBFou3kFOnR98qZuzJNTa5G0/9/nea7grmojQ3gfjPHXjAJzIiI4NqPmHnCT7r8ZOi
	/GdzNTaqysO8HYdT0P0YgFHEBIWXNKmqo5AFiE1qXEG1G8cjqxhiC1TmFah7DAx/gB/anx9Vn/H
	pd7Chj9DlePjrq9G7Pru3WqnVVqr8VVanwyTgrqk3wtNAohs8FW6eqONxGYgtWO0/WHOkMpUBnx
	1XzHAyVmo0ExooCj2z7ubFWmrsKoYFIl8dhqWxXjSU0XoTmECIn/RWnizYzI68wjNSxhvUsYWoI
	182DxkA8uvNTDkaPCvG/FqZs+zXXAzKUWw+3rMmxVYMK7qKVI0BbQaeVNONqxEeMz7Aae9Jl7Y/
	Hw2RLMrEdyQdvNWn90mE5kXd3XJ4DzHB4E6lggTGXvJG0IYnSw517gmkDULAT7t2Pd0xyE2o8+K
	Xl7BDzSIA8Svet/zE9f4WhUmUm+W1oynsgDhl+g6xyeViWJcnTMR1X2syZ0nJZIfllthBbegl8M
	Mm9Elk4CAJrTrtxKIPlPjbYXgPXdbK+gEyOuRs5ySnDhKe0M7Tk2xr9I1LW6DvoLDo9XGpCDRNT
	Cf8chcZVtgKlwQ==
X-Received: by 2002:a05:6000:2ac9:b0:487:27f6:a4e9 with SMTP id ffacd0b85a97d-48e264e8e4cmr4768462f8f.57.1792603568194;
        Wed, 21 Oct 2026 10:26:08 -0700 (PDT)
X-Received: from zito.localdomain ([102.90.98.139])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e254efb2csm7214727f8f.2.2026.10.21.10.26.06
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 21 Oct 2026 10:26:07 -0700 (PDT)
X-Cc: Azuama Odinaka Maximus <azuama69@gmail.com>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261021151253.3689-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