From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24621 invoked from network); 23 Mar 2008 15:54:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Mar 2008 15:54:45 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 98524 invoked from network); 23 Mar 2008 15:54:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Mar 2008 15:54:39 -0000 Received: (qmail 26461 invoked by alias); 23 Mar 2008 15:54:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24730 Received: (qmail 26444 invoked from network); 23 Mar 2008 15:54:34 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 23 Mar 2008 15:54:34 -0000 Received: from acolyte.scowler.net (acolyte.scowler.net [216.254.112.45]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6C6438097826 for ; Sun, 23 Mar 2008 16:54:28 +0100 (CET) Received: by acolyte.scowler.net (Postfix, from userid 1000) id 9A1C55C1ED; Sun, 23 Mar 2008 11:54:20 -0400 (EDT) Date: Sun, 23 Mar 2008 11:54:20 -0400 From: Clint Adams To: zsh-workers@sunsite.dk Cc: Joerg Jaspert , 469588@bugs.debian.org Subject: Re: Bug#469588: zsh: broken git completion if git is used with color enabled by default Message-ID: <20080323155420.GA14910@scowler.net> Mail-Followup-To: zsh-workers@sunsite.dk, Joerg Jaspert , 469588@bugs.debian.org References: <87ve40wvkk.fsf@vorlon.ganneff.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ve40wvkk.fsf@vorlon.ganneff.de> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Virus-Scanned: ClamAV 0.91.2/6344/Sun Mar 23 16:13:48 2008 on bifrost X-Virus-Status: Clean 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