Article View: linux.kernel.git
Article #2666Re: [PATCH] credential: parse subcommands with OPT_SUBCOMMAND
From: Tanga Joris
Date: Sun, 08 Nov 2026 22:28
Date: Sun, 08 Nov 2026 22:28
33 lines
12376 bytes
12376 bytes
Hi Edson,
Thanks for working on this, nice work adding subcommands completion for
"git credential".
On Thu, 5 Nov 2026 at 03:59, Wasswa Edson <edsonwasswa54@gmail.com> wrote:
> Besides making the code
> shorter and more idiomatic,
builtin/credential.c goes from 52 lines to 140, so maybe "shorter"
could go.
Overall, the patch looks good, but most of the new lines are the same
parse_options() call and check, repeated four times. Maybe a small helper
would work here?
> + if (argc)
> + usage_with_options(credential_fill_usage, options);
One small thing: no test covers this check. When I removed it, t0300
still passed. Maybe something like this?
test_expect_success 'credential subcommands reject extra arguments' '
for sub in fill approve reject capability
do
test_expect_code 129 git credential $sub extra
</dev/null || return 1
done
'
Thanks,
Tanga
Technical Details
Message-ID:
<CAKrRMNqsh=d+_C8u+q1EBeQVwDZaywGQGZ89oYLyyvmB=8u1jw@mail.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-74853-linux-kernel-git=dewy.ruReferences:
<20261104202228.24642-1-edsonwasswa54@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-74853-linux-kernel-git=dewy.ru
From: tangajoris@gmail.com (Tanga Joris)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] credential: parse subcommands with OPT_SUBCOMMAND
Date: Mon, 9 Nov 2026 01:28:21 +0300
Organization: Usenet Network
Message-ID: <CAKrRMNqsh=d+_C8u+q1EBeQVwDZaywGQGZ89oYLyyvmB=8u1jw@mail.gmail.com>
References: <20261104202228.24642-1-edsonwasswa54@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: usenet.network;
logging-data="221097"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:9M+iJaDOWTn6wf2UcTVAXoW7+CM= sha256:zjMmUrYPQ7eYWZMyP8+lYqO/XmjWn8R75vwXlbHmYIc=
sha1:N68EBF3t9VQCHTM/OaKDOYxkBa8= sha256:yElw5VmwTbPiN8Xjv1wMefSQpALXk9bSkW2wyMDhSNs=
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 BBDB7113648; Mon, 9 Nov 2026 01:36:49 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 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.249,
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 aEAHdvfc0tfG;
Mon, 9 Nov 2026 01:36:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74853-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 5DCD1113642; Mon, 9 Nov 2026 01:36:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 042D9A0A3E; Sun, 8 Nov 2026 22:29:14 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794176940;
b=OYuh6vMlq5aoCNdG+o/ggxxs+eGhkopQ24FtGAA18kKFmBnnKp5SL0r6MDT+NP7KqCFF
oaHiaadEzHLlMbxAhhYpT4ZyrfQPMT8cFG6eBC6yarHONv/JSCP/t9e25fhPs0QkMSjBB
o1RRpdtvZtzHUniDHECW3xbKCM7b23yVJ1+baXgCvtxkKtSxbzWZxMdl1JD0QxCY4gkOt
emFMu11Oe1dSLhKJCLvuu5YZceXncLorhlnc1h4UXrmDIKP5R3m4OXppQau5hsiajbbBR
Bp9xQDtk++Q0TrJTYafB1kqXvD2cQIH9JuUwjlfgclhqvsAndCWS/ncfwF0HPkI1IxQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794176940;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type;
bh=mmMvnKhXOpCxjY+iZNCCCrHjHcIF32xCYbczsTfp9Wk=;
b=aAJlVV2ur/mhjq9TcJSp5H971k+n5gchf+nynQZJqTEoS82DXo6wE2fFfBG3qzmLZ7vK
tX9xeguPpQ67/qhnS2tZbFwOViSI23b5vb1JiUSd1H9Tu8dPZ0ZjHNj4hmDUmhVjSU5vo
kNQ7aq2ssauo7AZebTNcby6dszrn3SbmlNrKYlZ0fQi0qGlo5I7IPeNJMKSsaPU9ubvZU
ysJj4oxpRdsPrXSFjsjDPtT2gmt74Ty5K0IMqK5KNGPH0MX4J2Lcyc8ylbETvWR9sFWNi
Gd+kWID7m0Fejf4FbQccue4wwd9Py5l/a0CP+OYb633a88quejPh/BsBlZ+8EvTjmDw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=QRTdxAqA;
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 08BC4606D82B;
Sun, 8 Nov 2026 22:29:00 +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=QRTdxAqA
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.161.41
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794176939;
b=JKeWqXOfaiAWI/7nrW030wY1Gnhc+hjvtflE2gm/O6vEKBUOXTxpKi1HkEjgngLs/BJz
Yp3Ktr8hBDrBX3fcUVLz/tEf8gzX/1xCtaeGYwrQ7kU8X5GNSFJWZMAR0BHDzYtTpbJGf
6gT3P0PXpDuiWje+MdkTxUyq5jkyW+xHFVn6Fxkp+yPA/ymSqgkiqT/w1ly3w7qi+/yO6
feSy0lfHTAwZ2YygvF2JqMYozG2KUHeWiIfKyFf4Iw0dWdJQKg1sURGAg8zRsvLDTMsAx
zIx98tPOFDaozCmKEjadc+ZdoWRJT/8UzcWPW2rcfEDqzCR6vo5dFw7LOE1NrN5hskw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794176939;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type;
bh=mmMvnKhXOpCxjY+iZNCCCrHjHcIF32xCYbczsTfp9Wk=;
b=yyupQDOGvWt7LKVHR6Q7/aGgtkhFb/ZYMXtPT6HqLxgUdWxlNe8rgZr97h2/x1hFfSIg
nCVLXf3stO1GSWjxFHXRiDVUBhrKw0/4jZkeGn8X+vFHko68LWDTJCEPB1lAVUVr+w3HW
SDOH12KHB4H8QOVozfQkz2H1pUao5YdzaIgO6G/tYtH3tyxCwHCUw7tj0OAlUNCGvM/IT
RNzKn+P6tif4jY0UK8bz6KzFW6OSISfU8Fq3rpE+a/JBVYaySZ8i8Ky29j2cekxOMdSsv
7KHpXLTd4kR9nCWpgx74XCy9VMjhdYgxOSHVuuM+7QLBqZMr+I6wnM6Dpcrz+6ZDAmw==
X-ARC-Authentication-Results: i=2; 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=QRTdxAqA;
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.161.41
X-Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41])
(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 C83CB606A334
for <git@vger.kernel.org>; Sun, 8 Nov 2026 22:28:58 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C83CB606A334
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-oo1-f41.google.com with SMTP id 006d021491bc7-6fe4372c5f3so182881eaf.3
for <git@vger.kernel.org>; Sun, 08 Nov 2026 14:28:58 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1794176938; cv=none;
d=google.com; s=arc-20260327;
b=ejE16Mlc4hHNkQNACmui2W9Eiy1CSo6Si7ZmthvgDKUmRe5l9B505u1FjDG5x+S7b2
qMfb0UNUERMPQOnjvdd6dLo09i8Ez4U9EqkiMRbeEGk00yFoPNMBkw6uBpJS2X1xrSY0
B5rWF2kPz7hcVRHHTfowT7MRWUNBe845srm5g66VWharBAXDbITSvVi0ntx676vlQpNL
pw0AIhMgGznhn9HGJQIlmgm6bfB78dIONIXze7oT7kNVDgsH+L2CZPDT51n5lzeD9VpV
te6aphso/0cu7t4w/ktig9+qhgoM7KK3XkcW1k9Ou5ht2fk/fAFhKNi1bKra/RIwD+jh
rCwQ==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:dkim-signature;
bh=mmMvnKhXOpCxjY+iZNCCCrHjHcIF32xCYbczsTfp9Wk=;
fh=RibIwiGwtzKC2Y0GHyBA/uOkHiJQGVNqyxcdxyQpGb0=;
b=hI6RrUqBSgJBGV/Lk+eWafipCoFds5MHzCHzD6qvmJqc5D3ubhqTtYXrtWQe3gIAdx
2sHFnyqSEhgpsJaU79OdS0Gai0T3z+uooDQTyPgefYbDP9/wN4tn3bS4HyffTdW8h5xp
Bshjk5SPym5KSZV1JaceNBENdAu9CLp8usDTWtTkbV5ySMTQRyxyY4MOa+sfGnEmmPry
VxKjoeSDxXG0JSMoPoqWfejVIetkya9bL+buraU2sOa+qqgtIq9/QBQG2sQiZ1Q/oTnC
T0iffaaTsA2jPzpomSVqdVvv9FGBT/n4k3Q7fXQFM0B9u15CBN00WNPbyDC/AG1qwaz4
EmZg==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794176938; x=1794781738; darn=vger.kernel.org;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=mmMvnKhXOpCxjY+iZNCCCrHjHcIF32xCYbczsTfp9Wk=;
b=QRTdxAqAMjzeNwDr145sV2fIermdhYn/gNlZLOBT8rc6X+H6FW3u5oZsYrfKn++f70
Og8seCPyphGRmw2DFFn73qdmZXjsHaBvwohlMKK4jErXwFRq3arSxgPcr8zsLCiXjBK9
JSKa/BkAGzoLzqrJY+kFSZOVuCd/oCH0Il6V6dGOdPt56odF4E3I9lKq/OCc/aqN31/7
nVSk0Bd/Y0lEgP9Q7v1Cexp+3VYN6p2pVDcKC7llMkcvhnguy/xJC9EqQLt7HerXGe5o
1nAX6Rfpy9V5EnJ7c68jRuSN+y4PuMTFuF5EX42+7y8kunw9GKu8mvsGm1uhVQt46z+J
fG8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794176938; x=1794781738;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=mmMvnKhXOpCxjY+iZNCCCrHjHcIF32xCYbczsTfp9Wk=;
b=nTmEQ0l1EhjuQhhx6auUcBujrRtoVBB/Pd6t/18CY5Jejwkmdxw52sETmnvhOUaCnV
qClrjb2QCXp/p1UiWdKi3n+8fgaQNKaBVfieFKFJ82hqFKMGRDKkV+atsSYAkCR6EwfV
Mv31hoUyit/qYUQJs4JQT4CYMFOCxWIwq7VH3ggPLR9orL71VE+hwXHSA3bv1VocOSN0
9q6XMDMwh0MlMAh0QVMzpdt6dBzSB5jvX/kd8lgLR8CumcyQMjo5rU0niuRkO3VLX9zM
TZMBjsiveoqz3fCpbO5mhyMatBgPd5gQWWNkgeHPAhNi2gxcERw0YP93Jl/PCyKhjz59
LFEQ==
X-Gm-Message-State: APuU4Z9uUGvSnoXoQZlzJpjT0pMbotp0d10dhjxMM1JX9/634EFL/1on
j2eQLkusvO0pePdonBapBteo4nV/repgiZ/gGWEqY9tsUnFeOUNBcwyz9g9ScTR0RzBvWQ9M1hU
DMk2L6JxAR2EFAL6982QW9UE6Bjv53TFWUKMS
X-Gm-Gg: AYBFou0dCHf/sxNwC4nfCN+LzkyM86YP9tkmMMkZMTh1p7UpfMTjMApOlrTJs1WinUc
JX7SD/t3KpP13pCuTuWNaiXmZFfR9f5LkqLdhnr1NAKBP4q88++NlZhkJNihJrgP3q9uTz7/eDD
TSucpcoJF+Uy7VOZ6E5NqgFJ+8t/OObgB0hsMx0c9MFNAoCMloyFgtKTsXQTf2Z1FM2lIK8JkLi
KvWFo9PO39DpzfAOc7asm69vCCguUTkW84W5porPsYeCfnujFHpgCETo7mUMK/DPDwUyekVP1aM
6fJYQch+4Xy/DNkFdrDyXA/k/JkpGCXJa+hfvvyjusym4YRaUjLL81QNijN86pKCrmWMLMr4qCM
xf193wccWty2ASNtv4zneF2NI1Be3AQEmgCFyied+HBpKfJ7NXV9umNJz1lXLQCKXhS9aXn9LiX
FdjObU9AbISqpUCMxGwh8esBYTjM2V4KOyETPZ60xkMRit3YCJ//6zxQ==
X-Received: by 2002:a05:6820:328a:b0:70d:ae12:71c5 with SMTP id
006d021491bc7-7170f333ce8mr1020190eaf.66.1794176937654; Sun, 08 Nov 2026
14:28:57 -0800 (PST)
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-In-Reply-To: <20261104202228.24642-1-edsonwasswa54@gmail.com>
X-Gm-Features: AclHuK9JFCaiS_LY4ICUcSRfc0kZxOv2ODx-X7OU7hLNTrJVTkGs1mz8c_HdRao
X-Cc: git@vger.kernel.org