From patchwork Thu Mar 18 09:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 12147723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CA63C433E9 for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B2D264F38 for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbhCRJr3 (ORCPT ); Thu, 18 Mar 2021 05:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbhCRJrH (ORCPT ); Thu, 18 Mar 2021 05:47:07 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3068AC06175F for ; Thu, 18 Mar 2021 02:47:07 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id a22-20020a17090aa516b02900c1215e9b33so4710605pjq.5 for ; Thu, 18 Mar 2021 02:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IIpYMGylFiunIm+41k6WE5Knld9pqSRDVCcGITfr4qo=; b=cl8Qtnoi9O6biUEifnGx2m1qk+kxkOxEZbyDS7tCpNUKfQfIR0HR0O6hW7Ra2pxb5u Rce+gs6Pt0nRuxuKaOlwTQ4BaAS+MK5v0CNCMnxyag6NmzmZpuhPaQUsvuHUUXKbGFlZ 3OQf4fe6ydHbKdkZ+KGQ7Hgmp2suXwVTql2rjnDvgpGWWzWBI4Ae+LGlTRNROZCBiqy+ rf2NC24b6KYLKCMusOB/EgG3Ipkp2739VwwvznyTXKjusrWeuDSlHSy3mVWAlGqqPq2Q if+IZW9xbPWgV+eo3lEaYfiWMo9YRanJ7U2H+kE6wNfp/urz+xdkkcJBqNcDG4MewEER FxKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IIpYMGylFiunIm+41k6WE5Knld9pqSRDVCcGITfr4qo=; b=coR/FGerUSNtZ2/sc4JkOyDJvsrgdkeH89zvVykTJfx67DDMqkvzswHuXWUxBHN1zN FPGuL/tDMhK/c4mqaAx525XrLGSFTatsRLBvLTL+pVuU2rE1O2ivHtTJSW3KOas5MBay ooSUA36hutA5N0Wub2aVcurfQlHM+62odvqdF2POcX8PrF85dALoQNcCgomwUu+zZbPa v2DiJdsUf685ewR3pDgwya0wTnSxqMKnYCGF6oRB0lDnp2ffBcWR3pT75ebiKmMWtYPp QfqAHQvGh3GpY/A4yw5OzqQ8hCakvonkpsVgswA7OFmKuUwE5ChkGXbRFTkVWMuV/yvq Gt9g== X-Gm-Message-State: AOAM5306+ABj+uRT7UsI6iEU40QvgRduKFQelUVigcve8zVgpFYj4LCF AksQ/50t8WCp04/yFrQRM7XXADHpdko= X-Google-Smtp-Source: ABdhPJzNys4lFbL6jrNZ0bqMvqb1pHE79UNQWDPCcFzSd4OWM0QnpFm1EpEdUZVq1EF0/zN1TC1haw== X-Received: by 2002:a17:90a:69c6:: with SMTP id s64mr3339447pjj.37.1616060826546; Thu, 18 Mar 2021 02:47:06 -0700 (PDT) Received: from archbookpro.localdomain ([172.92.165.181]) by smtp.gmail.com with ESMTPSA id b186sm1902326pfb.170.2021.03.18.02.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 02:47:06 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [RESEND PATCH 1/3] git-completion.bash: extract from else in _git_stash() Date: Thu, 18 Mar 2021 02:46:54 -0700 Message-Id: X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org To save a level of indentation, perform an early return in the "if" arm so we can move the "else" code out of the block. Signed-off-by: Denton Liu --- contrib/completion/git-completion.bash | 73 +++++++++++++------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7dc6cd8eb8..fe79f6b71c 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -3035,44 +3035,45 @@ _git_stash () fi ;; esac - else - case "$subcommand,$cur" in - push,--*) - __gitcomp "$save_opts --message" - ;; - save,--*) - __gitcomp "$save_opts" - ;; - apply,--*|pop,--*) - __gitcomp "--index --quiet" - ;; - drop,--*) - __gitcomp "--quiet" - ;; - list,--*) - __gitcomp "--name-status --oneline --patch-with-stat" - ;; - show,--*) - __gitcomp "$__git_diff_common_options" - ;; - branch,--*) - ;; - branch,*) - if [ $cword -eq 3 ]; then - __git_complete_refs - else - __gitcomp_nl "$(__git stash list \ - | sed -n -e 's/:.*//p')" - fi - ;; - show,*|apply,*|drop,*|pop,*) + return + fi + + case "$subcommand,$cur" in + push,--*) + __gitcomp "$save_opts --message" + ;; + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + drop,--*) + __gitcomp "--quiet" + ;; + list,--*) + __gitcomp "--name-status --oneline --patch-with-stat" + ;; + show,--*) + __gitcomp "$__git_diff_common_options" + ;; + branch,--*) + ;; + branch,*) + if [ $cword -eq 3 ]; then + __git_complete_refs + else __gitcomp_nl "$(__git stash list \ | sed -n -e 's/:.*//p')" - ;; - *) - ;; - esac - fi + fi + ;; + show,*|apply,*|drop,*|pop,*) + __gitcomp_nl "$(__git stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + ;; + esac } _git_submodule () From patchwork Thu Mar 18 09:46:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 12147721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CD0EC433DB for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3750964F10 for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbhCRJra (ORCPT ); Thu, 18 Mar 2021 05:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbhCRJrI (ORCPT ); Thu, 18 Mar 2021 05:47:08 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C18C061760 for ; Thu, 18 Mar 2021 02:47:08 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id bt4so2618914pjb.5 for ; Thu, 18 Mar 2021 02:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2AhOuynnxz3rTaWffeciWEZJbuzWh556g87pLPwc1po=; b=i3pktuFPxbCz9IsIIJLArfknUiUPz7RfyHCKDf/hI7VVByFchajcq1ubqO9iblikwF 4f4i2HvmJS9pGrMSZWvuLp4jE6TJlbmqTcZwYYM8lBBjVvc5aI3Hs659rWPlhUgrlkXd OHE22D0wFqviCAvhTd/Y42JKPEeqzBh6hxCh3LRqFPYOOA+ZwbWEDOjofsD+bY6bRDtl 1m7udbsZCiyEt4zfeSUaWFpLcRwlun8pjovcIFLYaXcGqI64PSWgYmsRKZfUIKKSY9lI 21m/jqaAjL3iTsamj6ckS50sNBVmYS0ZV3RfoR4E5HEKNndR5rwm3/W62taGCwixVEih kFJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2AhOuynnxz3rTaWffeciWEZJbuzWh556g87pLPwc1po=; b=LkFTC5umCTDgp2PYgrC+vAvGQxMDt7w1B3wmxdOenHYvnpdUpILK5sdACNV/9SLA2W s3Ynb3oJrAFIM7/kyr/X3lpRz2ohl3oKQ6Kfn6J8km0K6OZVHih8ILxZkAzPrIMFJRrH ubXZO2eFiauQvfxNPBj2JRFrirCr6zDCYSzmL7GPCTkgRVtkciVjWKTgV2Z0qwlzG14C Tgu5LFkO1sMJ3uzlkycS8Fu8g9SzOyUDS3LACveREAf7LAAgCYRKn6jZBJGrpHYBvCo5 LrpB5cUMCUmU4sQcK4EB/2O22ePVWyJGVs/axUVKjSHoV4tgJ4u/LyUSL8d79LnxWrGx AnhA== X-Gm-Message-State: AOAM531CysA1sWS+2TePw2vLWsIbcGpv39J3rAF9QcNjYBu8k2lA4TAT AANV+wp3Z+b/xj4SIqQ32mJ5G+/azxw= X-Google-Smtp-Source: ABdhPJxPdA5sgSgxgCkLDYHLK6dhUiYHGud7Ca0uQdxd6yUQZHSd3L6YbmmInSH6PfEGY32qhHGrDA== X-Received: by 2002:a17:902:fe0d:b029:e5:ffb8:1c28 with SMTP id g13-20020a170902fe0db02900e5ffb81c28mr8710460plj.62.1616060827524; Thu, 18 Mar 2021 02:47:07 -0700 (PDT) Received: from archbookpro.localdomain ([172.92.165.181]) by smtp.gmail.com with ESMTPSA id b186sm1902326pfb.170.2021.03.18.02.47.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 02:47:07 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [RESEND PATCH 2/3] git-completion.bash: fix `git ... stash branch` bug Date: Thu, 18 Mar 2021 02:46:55 -0700 Message-Id: X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When completions are offered for `git stash branch`, the user is supposed to receive refs. This works in the case where the main git command is called without arguments but if options are provided, such as `git -C dir stash branch`, then the `$cword -eq 3` provides incorrect results. Count the words relative to the first instance of "stash" so that we ignore arguments to the main git command. Unfortunately, this still does not work 100% correctly. For example, in the case of something like `git -C stash stash branch`, this will incorrectly identify the first "stash" as the command. This seems to be an edge-case that we can ignore, though, as other functions, such as _git_worktree(), suffer from the same problem. Signed-off-by: Denton Liu --- contrib/completion/git-completion.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fe79f6b71c..da46f46e3c 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -3016,6 +3016,9 @@ _git_stash () local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' local subcommands='push list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands save")" + local stash_idx="$(__git_find_on_cmdline --show-idx stash)" + stash_idx="${stash_idx% *}" + if [ -z "$subcommand" -a -n "$(__git_find_on_cmdline "-p")" ]; then subcommand="push" fi @@ -3060,7 +3063,7 @@ _git_stash () branch,--*) ;; branch,*) - if [ $cword -eq 3 ]; then + if [ $((cword - stash_idx)) -eq 2 ]; then __git_complete_refs else __gitcomp_nl "$(__git stash list \ From patchwork Thu Mar 18 09:46:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 12147725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84D75C43381 for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B4BE64F70 for ; Thu, 18 Mar 2021 09:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbhCRJrc (ORCPT ); Thu, 18 Mar 2021 05:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbhCRJrJ (ORCPT ); Thu, 18 Mar 2021 05:47:09 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD1CC06174A for ; Thu, 18 Mar 2021 02:47:09 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id nh23-20020a17090b3657b02900c0d5e235a8so2854059pjb.0 for ; Thu, 18 Mar 2021 02:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y/FyqYdUrIEtuuDrl3IU5HHgBCKoHDsokOpXAuTpXVA=; b=oSeZ3pGNsCvUazbHJuxh9VbzNbe2zmTRkpdSPzP2CBpyjZkcvbrNnfF4bxWFYOsZHh fZO0rgV0smndSqyXS7sJDYji6ViCrAHL2+JQcDb1HvkIZUK0OF1fKh1o5+FlYRwQAUt+ Ic/QngH40z41ybBEvedEZ6Su9kriJ/J2VwCXL+qaNAk75YhATlNBVVdP87TW0vJAvx7K VKYYNOfmqYRUfsD1UU3Ba8Lwj6IOzs8gso7jLNPLsxwmWtmXJC+kynOtQL6+Pd19B4JD yfTD6XD6E0wgLunIlE4o0DkxR7/z8O4qxhY0gOJJdOHsjKv/F735j5hMgognwsnsoZEw 4iiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y/FyqYdUrIEtuuDrl3IU5HHgBCKoHDsokOpXAuTpXVA=; b=Eth3wwaInk/1Es1ww6xWu0BjG0MC3QmaujK+/wCxJJsQEyC0J1PxZhffNafDtw2I4O WvdAED3lnHm1Zpv12nPlggrRWyP38uQ8O3yWeJrYArKMicneAKo8y9wZAtRydM5Ueyq7 6weTctxu2i4OqYZti9mf3MSTUmauBotC1bvsXVjzlzHmInNggJoGhjN+8HScD1663iiy LfQwEY6RzH7/daLEQCAQtlUA5bzYVjFse8OMk4Pura38e3cEWlz1kRIhTnJoyc4QpPeq vVtu4ID6EX7CN4/59HZ7On9aT4huQAB3htK6x7zoIZBUxOsiA8Ub9sKeLKlcZOzZwbKz 68zA== X-Gm-Message-State: AOAM530gadV8lEvIcMk9xlRMXAMmAYmEfPjUxkOsBfOjXEP7WMReRDNP UpeXzgTpgr6Sua716k7XkaGsfFFtVnI= X-Google-Smtp-Source: ABdhPJzm2EBCTaZJIKpIkbuhgUnXrdOtkJ2cryMtX5KxaXA69zja5HwpnOCenBdbYkqa4Jcb52+D2A== X-Received: by 2002:a17:90b:4b0e:: with SMTP id lx14mr3358615pjb.147.1616060828477; Thu, 18 Mar 2021 02:47:08 -0700 (PDT) Received: from archbookpro.localdomain ([172.92.165.181]) by smtp.gmail.com with ESMTPSA id b186sm1902326pfb.170.2021.03.18.02.47.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 02:47:08 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [RESEND PATCH 3/3] git-completion.bash: use __gitcomp_builtin() in _git_stash() Date: Thu, 18 Mar 2021 02:46:56 -0700 Message-Id: X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The completion for 'git stash' has not changed in a major way since it was converted from shell script to builtin. Now that it's a builtin, we can take advantage of the groundwork laid out by parse-options and use the generated options. Rewrite _git_stash() to take use __gitcomp_builtin() to generate completions for subcommands. The main `git stash` command does not take any arguments directly. If no subcommand is given, it automatically defaults to `git stash push`. This means that we can simplify the logic for when no subcommands have been given yet. We only have to offer subcommand completions when we're completing the word after "stash". Unfortunately, this does not work 100% correctly. For example, in the case of something like `git -C stash stash`, this will incorrectly identify the first "stash" as the command. This seems to be an edge-case that we can ignore, though, as other functions, such as _git_worktree(), suffer from the same problem. One area that this patch could improve upon is that the `git stash list` command accepts log-options. It would be nice if the completion for this were unified with that of _git_log() and _git_show() which would allow completions to be provided for options such as `--pretty` but that is outside the scope of this patch. Signed-off-by: Denton Liu --- contrib/completion/git-completion.bash | 41 ++++++++++++-------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index da46f46e3c..83b6415b13 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -3013,29 +3013,21 @@ _git_sparse_checkout () _git_stash () { - local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' local subcommands='push list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands save")" local stash_idx="$(__git_find_on_cmdline --show-idx stash)" stash_idx="${stash_idx% *}" - if [ -z "$subcommand" -a -n "$(__git_find_on_cmdline "-p")" ]; then - subcommand="push" - fi if [ -z "$subcommand" ]; then - case "$cur" in - --*) - __gitcomp "$save_opts" + case "$((cword - stash_idx)),$cur" in + *,--*) + __gitcomp_builtin stash_push ;; - sa*) - if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then - __gitcomp "save" - fi + 1,sa*) + __gitcomp "save" ;; - *) - if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then - __gitcomp "$subcommands" - fi + 1,*) + __gitcomp "$subcommands" ;; esac return @@ -3043,24 +3035,29 @@ _git_stash () case "$subcommand,$cur" in push,--*) - __gitcomp "$save_opts --message" + __gitcomp_builtin stash_push ;; save,--*) - __gitcomp "$save_opts" + __gitcomp_builtin stash_save ;; - apply,--*|pop,--*) - __gitcomp "--index --quiet" + pop,--*) + __gitcomp_builtin stash_pop + ;; + apply,--*) + __gitcomp_builtin stash_apply ;; drop,--*) - __gitcomp "--quiet" + __gitcomp_builtin stash_drop ;; list,--*) - __gitcomp "--name-status --oneline --patch-with-stat" + # NEEDSWORK: can we somehow unify this with the options in _git_log() and _git_show() + __gitcomp_builtin stash_list "$__git_log_common_options $__git_diff_common_options" ;; show,--*) - __gitcomp "$__git_diff_common_options" + __gitcomp_builtin stash_show "$__git_diff_common_options" ;; branch,--*) + __gitcomp_builtin stash_branch ;; branch,*) if [ $((cword - stash_idx)) -eq 2 ]; then