Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#469588: zsh: broken git completion if git is used with color enabled by default
- X-seq: zsh-workers 24730
- From: Clint Adams <schizo@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Bug#469588: zsh: broken git completion if git is used with color enabled by default
- Date: Sun, 23 Mar 2008 11:54:20 -0400
- Cc: Joerg Jaspert <joerg@xxxxxxxxxx>, 469588@xxxxxxxxxxxxxxx
- In-reply-to: <87ve40wvkk.fsf@xxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-workers@xxxxxxxxxx, Joerg Jaspert <joerg@xxxxxxxxxx>, 469588@xxxxxxxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <87ve40wvkk.fsf@xxxxxxxxxxxxxxxxx>
On Thu, Mar 06, 2008 at 01:22:03AM +0100, Joerg Jaspert wrote:
> Hi
>
> I have git configured to always color stuff, ie. having
> [color]
> diff = always
> branch = always
> status = always
>
> in my .gitconfig.
>
> Now, zsh completion for git gets it a little wrong:
>
> $ git branch [TAB][TAB]
> branch-name
> $'\033'\[32mmaster$'\033'\[m error_handling$'\033'\[m generate_mails$'\033'\[m
>
> So it would be nice if the completion could filter out the color codes.
>
> Thanks.
>
> (Severity minor, as this is thanks to a user config, but it's still
> broken, so a little above wishlist, I think. :) )
I didn't run into this because I use "auto" instead of "always".
Hopefully this covers all the color-exuding commands.
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.62
diff -u -r1.62 _git
--- Completion/Unix/Command/_git 9 Mar 2008 12:29:52 -0000 1.62
+++ Completion/Unix/Command/_git 23 Mar 2008 15:51:44 -0000
@@ -2646,7 +2646,7 @@
__git_changed_files () {
local -a files
- files=(${(ps:\0:)"$(_call_program files git diff-index -z --name-only HEAD 2>/dev/null)"})
+ files=(${(ps:\0:)"$(_call_program files git diff-index -z --name-only --no-color HEAD 2>/dev/null)"})
__git_command_successful || return
_wanted files expl 'index file' _multi_parts $@ - / files
@@ -2830,7 +2830,7 @@
local expl
declare -a branch_names
- branch_names=(${${(f)"$(_call_program heads git branch -a 2>/dev/null)"}#[* ] })
+ branch_names=(${${(f)"$(_call_program heads git branch --no-color -a 2>/dev/null)"}#[* ] })
__git_command_successful || return
_wanted heads expl branch-name compadd $* - $branch_names
@@ -2894,7 +2894,7 @@
local expl
declare -a branch_names
- branch_names=(${${(f)"$(_call_program branch-names git branch 2>/dev/null)"}#[* ] })
+ branch_names=(${${(f)"$(_call_program branch-names git branch --no-color 2>/dev/null)"}#[* ] })
__git_command_successful || return
_wanted branch-names expl branch-name compadd $* - $branch_names
Messages sorted by:
Reverse Date,
Date,
Thread,
Author