Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/9] completion git: support aliases when \n exist
- X-seq: zsh-workers 33151
- From: Marc Finet <m.dreadlock@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 2/9] completion git: support aliases when \n exist
- Date: Fri, 12 Sep 2014 23:30:36 +0200
- Cc: Marc Finet <m.dreadlock@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QdGBtznTZSZub0GDVqNEGf8B3Xhu04cl+wdnLdc0rLc=; b=Pt9tVkK2R6ZSX/3+HyK1iUfHOOJB0ASa+Wf2tsggS+Y3VfgAtlHK6/mSEzTKwcTgxN 4Q3s4sCt3m7w7C1u3Btknhwt55ZxwY/KWiSx3Vd2B6wfzv/FLDm+6PN2eLtc3gTXmo6C sb13ZnwcBSRi0ySwLpU+EVk2NfShfx/e/GThTrlJBEL5ADR/qFYrLu3uR5N5oesAzNA6 8gkx5fFIUXIhTFsoBzlZAw5p+zr/ga+sm/S+dejW6G96aXkbB2CFyajmDSJF00VicXpB 8U88fAZlc6/LSLMNDSs/j1yy7tn3Wg9WLLvOy/GUkL/Ao7/zDSRXY9rlsrbOE00rBzwc GjGA==
- In-reply-to: <1410557443-24178-1-git-send-email-m.dreadlock@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1410557443-24178-1-git-send-email-m.dreadlock@gmail.com>
The git completion for aliases (i.e. completing with aliased verb)
was broken whem some \n exist in aliases.
---
Completion/Unix/Command/_git | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index b1f411a..d941aac 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
--
2.1.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author