Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> --- contrib/completion/git-completion.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index bf2a59f95e..ce0dc1e0f8 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1121,17 +1121,17 @@ __git_pretty_aliases () # __git_aliased_command requires 1 argument __git_aliased_command () { - local cur=$1 last list word cmdline + local cur=$1 list word cmdline - while [[ "$cur" != "$last" ]]; do + while [[ -n "$cur" ]]; do if [[ "$list" == *"$cur "* ]]; then # loop detected return fi cmdline=$(__git config --get "alias.$cur") - last=$cur list="$cur $list" + cur= for word in $cmdline; do case "$word" in @@ -1154,6 +1154,7 @@ __git_aliased_command () done done + cur="${list%% *}" if [[ "$cur" != "$1" ]]; then echo "$cur" fi -- 2.29.2