From: Felipe Contreras Date: Tue, 10 Nov 2020 21:21:23 GMT Subject: [PATCH v2 13/26] completion: bash: simplify __gitcomp Message-ID: <20201110212136.870769-14-felipe.contreras@gmail.com> In-Reply-To: <20201110212136.870769-1-felipe.contreras@gmail.com> It's not possible for $cur_ to have anything more than --no- at this point, so there's no need to add a suffix, nor check anything else. All we are doing is checking that $cur_ matches --no, and adding a completion if so. This way the code reflects what we are doing. Signed-off-by: Felipe Contreras --- contrib/completion/git-completion.bash | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8b4308fc99..9f5dd4e3e7 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -332,9 +332,8 @@ __gitcomp () continue fi - c="--no-...${4-}" - if [[ $c == "$cur_"* ]]; then - COMPREPLY[i++]="${2-}$c " + if [[ --no == "$cur_"* ]]; then + COMPREPLY[i++]="--no-... " fi break fi -- 2.29.2