diff options
author | Marc Finet <m.dreadlock@gmail.com> | 2014-09-12 23:30:36 +0200 |
---|---|---|
committer | Frank Terbeck <ft@bewatermyfriend.org> | 2014-09-14 12:02:35 +0200 |
commit | ffd439b69b49c2762eaee888d622d7e843103c62 (patch) | |
tree | a2f1fda863f68d93a9b0ce83c0eb7c0a8824faa2 | |
parent | 6ec8cfdeaa94c6b7a1067a47162644df3a97acb7 (diff) | |
download | zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.gz zsh-ffd439b69b49c2762eaee888d622d7e843103c62.tar.xz zsh-ffd439b69b49c2762eaee888d622d7e843103c62.zip |
33151: completion git: support aliases when \n exist
The git completion for aliases (i.e. completing with aliased verb) was broken whem some \n exist in aliases.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 42fb37ed1..5bf50a499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * 33149: Misc/vcs_info-examples: vcs_info examples: fix typo + * 33151: Completion/Unix/Command/_git: completion git: support + aliases when \n exist + 2014-09-12 Barton E. Schaefer <schaefer@zsh.org> * 33143: Src/init.c: POSIX_ARGZERO more closely matches bash et al. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b1f411a5e..d941aac0f 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6560,9 +6560,13 @@ _git() { if (( CURRENT > 2 )); then local -a aliases local -A git_aliases - # TODO: Should use -z here, but I couldn't get it to work. - aliases=(${(f)${${${(f)"$(_call_program aliases git config --get-regexp '\^alias\.')"}#alias.}/ /$'\n'}/(#e)/$'\n'}) - (( $#aliases % 2 == 0 )) && git_aliases=($aliases) + local k v + aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) + for a in ${aliases}; do + k="${${a/$'\n'*}/alias.}" + v="${a#*$'\n'}" + git_aliases[$k]="$v" + done if (( $+git_aliases[$words[2]] && !$+commands[git-$words[2]] && !$+functions[_git-$words[2]] )); then local -a tmpwords expalias |