[PATCH v2 13/26] completion: bash: simplify __gitcomp
From: Felipe Contreras <hidden>
Date: 2020-11-10 21:22:08
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Felipe Contreras <hidden>
Date: 2020-11-10 21:22:08
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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