diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ffedce7..dfceda0 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -23,6 +23,9 @@
# 3) Consider changing your PS1 to also show the current branch,
# see git-prompt.sh for details.
+alias_words=()
+alias_cword=0
+
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi@@ -708,19 +711,22 @@ __git_aliased_command ()
{
local word cmdline=$(git --git-dir="$(__gitdir)" \
config --get "alias.$1")
+
for word in $cmdline; do
case "$word" in
\!gitk|gitk)
- echo "gitk"
+ eval "$2='gitk'"
return
;;
\!*) : shell command alias ;;
- -*) : option ;;
+ -*) : option
+ alias_words=("${alias_words[@]}" "$word")
+ ((alias_cword++))
+ ;;
*=*) : setting env ;;
git) : git itself ;;
*)
- echo "$word"
- return
+ eval "$2='$word'"
esac
done
}@@ -739,6 +745,17 @@ __git_find_on_cmdline ()
done
((c++))
done
+ c=0
+ while [ $c -lt $alias_cword ]; do
+ word="${alias_words[c]}"
+ for subcommand in $1; do
+ if [ "$subcommand" = "$word" ]; then
+ echo "$subcommand"
+ return
+ fi
+ done
+ ((c++))
+ done
}
__git_has_doubledash ()@@ -2353,6 +2370,8 @@ _git_whatchanged ()
__git_main ()
{
+ alias_words=()
+ alias_cword=0
local i c=1 command __git_dir
while [ $c -lt $cword ]; do@@ -2394,8 +2413,8 @@ __git_main ()
local completion_func="_git_${command//-/_}"
declare -f $completion_func >/dev/null && $completion_func && return
-
- local expansion=$(__git_aliased_command "$command")
+ local expansion=''
+ __git_aliased_command $command expansion
if [ -n "$expansion" ]; then
completion_func="_git_${expansion//-/_}"
declare -f $completion_func >/dev/null && $completion_func--
1.7.12.rc0.91.gf4edd99