summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2008-03-05 19:07:49 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2008-03-11 00:02:15 (GMT)
commit5447aac755e5cfb948c627762b4665801811b026 (patch)
treeb14e54050cf1508ae0a5adc3aa7f44bae1f29ec3
parentce5a2c956f10f84d8403fc4e94106a6b33a5024a (diff)
downloadgit-5447aac755e5cfb948c627762b4665801811b026.zip
git-5447aac755e5cfb948c627762b4665801811b026.tar.gz
git-5447aac755e5cfb948c627762b4665801811b026.tar.bz2
bash: fix long option with argument double completion
Pressing TAB right after 'git command --long-option=' results in 'git command --long-option=--long-option=' when the long option requires an argument, but we don't provide completion for its arguments (e.g. commit --author=, apply --exclude=). This patch detects these long options and provides empty completion array for them. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xcontrib/completion/git-completion.bash22
1 files changed, 15 insertions, 7 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2d11d0a..5046f69 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -121,13 +121,21 @@ __gitcomp ()
if [ $# -gt 2 ]; then
cur="$3"
fi
- for c in $1; do
- case "$c$4" in
- --*=*) all="$all$c$4$s" ;;
- *.) all="$all$c$4$s" ;;
- *) all="$all$c$4 $s" ;;
- esac
- done
+ case "$cur" in
+ --*=)
+ COMPREPLY=()
+ return
+ ;;
+ *)
+ for c in $1; do
+ case "$c$4" in
+ --*=*) all="$all$c$4$s" ;;
+ *.) all="$all$c$4$s" ;;
+ *) all="$all$c$4 $s" ;;
+ esac
+ done
+ ;;
+ esac
IFS=$s
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
return