Article View: linux.kernel.git
Article #1280[PATCH v2 1/5] completion: simplify stash subcommand completion
From: "D. Ben Knoble"
Date: Fri, 23 Oct 2026 13:20
Date: Fri, 23 Oct 2026 13:20
45 lines
12666 bytes
12666 bytes
The stash completion helper contains a hard-coded list of commands, but
git-stash provides a mechanism to list such commands
(--git-completion-helper). The pattern for using it is wrapped by
__git_resolve_builtins, so use it, bringing _git_stash closer in line
with other completion helpers. As a nice side-benefit, this also adds
"store" subcommand completion, which is missing from the explicit list
of subcommands.
Note that we maintain the "save" special case†, since it was removed from
default completion in 0eb5a4f911 (completion: stop showing 'save' for
stash by default, 2018-04-20). One might think we need to give "save" to
__git_resolve_builtins' 3rd exclude argument to prevent it from
showing up, but we don't: "save" is already marked PARSE_OPT_NOCOMPLETE.
†We don't complete the "save" subcommand unless at least "sa" has been
typed, but we do complete its options if explicitly typed. With this
change, we will complete "save" if GIT_COMPLETION_SHOW_ALL=1.
Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
---
contrib/completion/git-completion.bash | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c3a49e2e22..d60e85479c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3553,8 +3553,12 @@ _git_sparse_checkout ()
_git_stash ()
{
- local subcommands='push list show apply clear drop pop create branch import export'
- local subcommand="$(__git_find_on_cmdline "$subcommands save")"
+ local subcommands subcommand
+
+ __git_resolve_builtins stash
+
+ subcommands="$___git_resolved_builtins"
+ subcommand="$(__git_find_on_cmdline "$subcommands save")"
if [ -z "$subcommand" ]; then
case "$((cword - __git_cmd_idx)),$cur" in
--
2.56.0.237.g5414b88716.dirty
Technical Details
Message-ID:
<90d36b64450a21e9afed62c66fd3f72e4c4d429f.1792761643.git.ben.knoble@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-73017-linux-kernel-git=dewy.ruReferences:
<cover.1791827304.git.ben.knoble@gmail.com> <cover.1792761643.git.ben.knoble@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-73017-linux-kernel-git=dewy.ru
From: ben.knoble@gmail.com ("D. Ben Knoble")
Newsgroups: linux.kernel.git
Subject: [PATCH v2 1/5] completion: simplify stash subcommand completion
Date: Fri, 23 Oct 2026 09:20:51 -0400
Organization: Usenet Network
Message-ID: <90d36b64450a21e9afed62c66fd3f72e4c4d429f.1792761643.git.ben.knoble@gmail.com>
References: <cover.1791827304.git.ben.knoble@gmail.com> <cover.1792761643.git.ben.knoble@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="509597"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:EPSPb7D4vfjmWTika/61kzUm58w= sha256:q+q5h0zrSeKXkFUCWff+EMm3SR4fSmV7Cm6691S/Usc=
sha1:MJa1IN3Ow/0lm/wqaZ3hFH6G9vE= sha256:t+sSCvIAGi76CwnAkH40wVvGPQE9ElxonpYRVJfAevc=
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 3D5D91114B9; Fri, 23 Oct 2026 16:33:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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] 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 CkB0XvF--c1A;
Fri, 23 Oct 2026 16:33:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73017-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 3999811147F; Fri, 23 Oct 2026 16:33:20 +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 2E1F3392A8; Fri, 23 Oct 2026 13:27:58 +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=1792762078;
b=rZiWnwWMOxhPk/Euu9OfFp5myJkocCJRwPNypRQ3cOzTQn+yecfdWQb5ax2mjcDiKlkB
1bTF8KzEHpwASmF5qM5silgLUR8KAsExI7iHLyfn/60fCpVinvO147gv7Ut3KOpcWFLZv
AHwBnXFf03XSfJxSmextT7g7SEE//AQ69HnBnoXIfiLlJVpJQIO2MEb8x8x5KyBVt97dL
6j6hDXaB3SVb6F4XflwJouScNUwjX6V9kBhbrzEkI2ACWKIdpLTJSuky01HCmQVLg/r0m
LdwYuUDw2h2fCacuMKl7VRss7T8HuAQUI35qCh3Vwzu2Zd0qyEM/zwPxWYdcxoYMewA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792762078;
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-Type:
Content-Transfer-Encoding;
bh=ZiCrwfJvhGKIskYGCDYikrZrQXypO7VBKYxNATiWUzg=;
b=RS+QvmbIByGxOU7GVKNSt+z/nKbwPs+Y2FxZjeH/7gqaLRk+YtUPMTAiDJHwqTVTsejC
3gztCV4A0BXJ6SzhrNHe/USy+gUsVbgFrSkMo/aJBz0ku7xF9c2ERuCTqnN3BED8h8w9Q
7m0auh9c0hlgUAQ4FIpboIGeEiPMRh9n7bfw31HAaKn4S10+wtLLmEjgQ4WJkDTeNOGSr
xmle+Q5eIGpYdD2tM8Qcynq1diHMHxA78kCo7iY32TJfHes3F5krYI0Xjie2X5q0oydcL
N7qCyYJA03TmQj0hClfps1XDFCg2Fm+9yqx9hObPlSLGnuQ439HXjdjBnzSwHI7kpoQ==
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=TmotoELF;
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 01B12606A31D;
Fri, 23 Oct 2026 13:27:58 +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=TmotoELF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792762077;
b=GA4vQ0eY+2nWqg+jrL5y33yY7qf8mgD7dtDxlMSH5oL26n8X0o4ljlzq1fSo8IOaGvUh
xgoP5ozrKhAKNjvMfM+wK04ZO8N3zDaX8mfULWP4jgnWN/My+qu0IQwmuz/L2TdwBaWyO
wF/uvmycd2hJCD5IfBGVFXOxCfKZbWNmSXf2HsJfXJLQbA9BziiPk+tYPrKTyejyHBLxQ
oIY8wIx358xX+GzSo2RjtGozAPmpTc1O0v1wscOPrZsCTskGdoUCm62q4yMeDvN+e7q0E
LgSQMiRHWoyzP2yhMV5BENu24/OGqIVSbuSahcG3bk7gUhRAmPIay+YVY9KvJwsvYXw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792762077;
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-Type:Content-Transfer-Encoding;
bh=ZiCrwfJvhGKIskYGCDYikrZrQXypO7VBKYxNATiWUzg=;
b=uLPvfXnB1VvGL807DRoLuRwXJTdWsnr9R+ix0zxwmHhvy4Jugbi/VM1wz4n5uCTGzN+A
ib5J5lX+6Eu+Xc0mo1mncD16M54APaHwfbu5WmHYdnhuxSBkwPtocKSWuF8cYJ+W5of8c
IYGBFSzmLT+v1nTLHbi7E/GTzxUeGLV51W0Hbo4snVa3rawc8O1+Mm2+tgao6ZBzybMdk
Dv/1y/3hUrokbSHiXYO6mcQTBl0+BD1TkiZAwbT63GsbgvlEzr2uqcVRtxFRek+qdsLYM
NLnJZswVNXtpjWDUbX989aoR8S6GaLq4wE6ZaDE6me8BH+VrqqvF+PvHUVWqlphtigg==
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=TmotoELF;
arc=none smtp.remote-ip=209.85.128.175
X-Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175])
(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 BD57D606A31F
for <git@vger.kernel.org>; Fri, 23 Oct 2026 13:27:56 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BD57D606A31F
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-yw1-f175.google.com with SMTP id 00721157ae682-8ab38a051aaso8555297b3.3
for <git@vger.kernel.org>; Fri, 23 Oct 2026 06:27:56 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792762076; x=1793366876; darn=vger.kernel.org;
h=content-transfer-encoding:content-type: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=ZiCrwfJvhGKIskYGCDYikrZrQXypO7VBKYxNATiWUzg=;
b=TmotoELFnRLZS0pPJEDKRJbgS/G/jBaHqK7qVQR1gK0Jv/R2WN82486o8Qmd1HDmE7
IkRhCNjxZZ0J3yGDKvOqnG2JI4jpEbiEFoQ4G+zpVuy538HK2oQql+Eo8xHnOCJSy11t
XTKenpNXqz92PKl30JTY1Ykr2pUmw0YEOlsTmDqxoKRdmXwpA6V0XZfEY1DAEkf9IRk+
mBx8AvttOuP+iHJ72IU0jztfauL9gxDQhiJDVFl/3BMN1ROtSiRmZYbTlGJTswykBhcb
7snP/5vwxG9MZI9hC1bWzcwOmZ1tnPnXGlfwgGbAp7FInU0wroPZquznGtfetaDPh69Z
FByA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792762076; x=1793366876;
h=content-transfer-encoding:content-type: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=ZiCrwfJvhGKIskYGCDYikrZrQXypO7VBKYxNATiWUzg=;
b=tcp/fgtTV8UrXl5cpv+hJfvgm+zFPFn6uSVUV6OpvEfJ4SrLJROgSM3cMD7a1OL5R/
Il0CcWE5ySB2Bn333nQFMu83SoT+7RUUjeEg6FAkZ1vy8VnZ4As+tbBeSTaZNMOkbfpt
TXUcvzJVfqxPrEos0qp3+4vk5NhhalW3nj9OJgGPSATISalWWp1Q95orXxKJVw+bjlUI
HKxPkDMM9n1IFPxT3gGxIk5ulDzdg1IB0w+1MlEQcsdi1s6xUpRQvKMbW6m3IDZk7w79
AeFwuSxcOac9l6o9uc5b599J2NGn5IU16Wfng3EZf70lJMajzzlN+9FgK/UxoRFM7HM9
oX0w==
X-Gm-Message-State: AFq9FYKfsNg8XP3e0/8lNdNP38CwSrdyY+InqriSIy/Vxm0jDDmtWh5t
N7x+KxGnyFF267U+rJrqkLht7ByLar7yDzEDjJ3Bt//ujhRlxc7+CzOVF3Np3q36
X-Gm-Gg: AYBFou2SDmkmNrngsdsQLQU5j1+7IesnKEnRLA0bd6xFB/7A/CMxALw3hPphwhFJsgM
3HpdcfgzmseNCA3S9vX4gVcAKSNNXf9f2pBmaRuIu1EOZFpgYflG9q5Ngi9MzAQrAM8hWG4JLkp
dTYt/9KoGvCbgb8uptx7+9NotByP/HPxju8BwzIdJ7TA2VByfpTEYhK4bs5XDpSVS/mLKwBTfWE
mv8zUbxGy7IPdtkoSZ0UlAOgPQx2ai82nZfP6n7f3ClyjUO3+2bF+Er9cYmPtNMO2NiHOpUdxL9
cGid8m8hacsF5XUnnd9uQwbC9/OqkUPXlX5V4oPRyRd8f+w1lixOCOmdhtkA7UvmZi8NN4uVh0f
1OZ+Bmk2dS95j1xKc0IoXNA3UwBMI4TNwVHUES1miJXdG53MbOTu7A+JANPsgtHAjsVOA83yGGQ
Iuc4Fnx1RKw6H1yC01JNaFg1VOq3t2Tce1VUemRxN3Vnw/LuMgZcs+JfC2uothSH7jWOkMV3tNk
tbZ9zXCb9EKi+rCE+CpJm/5PVLrziKTvhB7hvVa/9aGiQDOQP7tpFi62/e0CS98As6tdsnxokcY
lbZeqjlkgowHsxwXupBuf7lCG7YksraI2+sW40MU1qqD/mlJQKb0n9tsax0SMVRo0+Aju/4zUKJ
XPic=
X-Received: by 2002:a05:690c:4dc8:10b0:8ab:4989:bc9d with SMTP id 00721157ae682-8b157df7ef3mr12654007b3.65.1792762075807;
Fri, 23 Oct 2026 06:27:55 -0700 (PDT)
X-Received: from merguez.lyrebird-fence.ts.net ([2605:a601:9d17:3000::3])
by smtp.gmail.com with ESMTPSA id 00721157ae682-8b156183032sm12898647b3.34.2026.10.23.06.27.55
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 23 Oct 2026 06:27:55 -0700 (PDT)
X-Cc: "D. Ben Knoble" <ben.knoble@gmail.com>,
Patrick Steinhardt <ps@pks.im>,
Junio C Hamano <gitster@pobox.com>
X-Mailer: git-send-email 2.56.0.237.g5414b88716.dirty
X-In-Reply-To: <cover.1792761643.git.ben.knoble@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