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 ++---
contrib/completion/git-completion.zsh | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index b4b778da0b..ebf8df94e8 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -341,9 +341,8 @@ __gitcomp ()
continue
fi
- c="--no-...${4-}"
- if [[ $c == "$cur_"* ]]; then
- COMPREPLY[i++]="${2-}$c "
+ if [[ --no == "$cur_"* ]]; then
+ COMPREPLY[i++]="--no-... "
fi
break
fidiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index c7e4de15c6..6008a73816 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -63,7 +63,7 @@ __gitcomp ()
for c in ${=1}; do
if [[ $c == "--" ]]; then
[[ "$cur_" == --no-* ]] && continue
- array+=("--no-...${4-} ")
+ array+=("--no-... ")
break
fi
c="$c${4-}"--
2.32.0