aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-11-27 15:10:42 -0500
committerJunio C Hamano <junkio@cox.net>2006-11-27 12:57:15 -0800
commitce1e39d29ee373786ceda9e79d0906a6451ab5a5 (patch)
treebfe2228fe7f39cceaa63498bc4e26eba825ae780 /contrib
parent5de40f59d4954738448e238b06eed72f73cca740 (diff)
downloadgit-ce1e39d29ee373786ceda9e79d0906a6451ab5a5.tar.gz
git-ce1e39d29ee373786ceda9e79d0906a6451ab5a5.tar.xz
Support --strategy=x completion in addition to --strategy x.
Because git-merge and git-rebase both accept -s, --strategy or --strategy= we should recognize all three formats in the bash completion functions and issue back all merge strategies on demand. I also moved the prior word testing to be before the current word testing, as the current word cannot be completed with -- if the prior word was an option which requires a parameter, such as -s or --strategy. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash30
1 files changed, 20 insertions, 10 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 73c67691c..16b8dda17 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -435,18 +435,23 @@ _git_log ()
_git_merge ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
+ -s|--strategy)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
+ return
+ esac
case "$cur" in
+ --strategy=*)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
+ -- "${cur##--strategy=}"))
+ return
+ ;;
--*)
COMPREPLY=($(compgen -W "
--no-commit --no-summary --squash --strategy
" -- "$cur"))
return
esac
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
- return
- esac
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
}
@@ -523,18 +528,23 @@ _git_rebase ()
" -- "$cur"))
return
fi
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
+ -s|--strategy)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
+ return
+ esac
case "$cur" in
+ --strategy=*)
+ COMPREPLY=($(compgen -W "$(__git_merge_strategies)" \
+ -- "${cur##--strategy=}"))
+ return
+ ;;
--*)
COMPREPLY=($(compgen -W "
--onto --merge --strategy
" -- "$cur"))
return
esac
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- COMPREPLY=($(compgen -W "$(__git_merge_strategies)" -- "$cur"))
- return
- esac
COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
}