zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Cc: Joerg Jaspert <joerg@debian.org>, 469588@bugs.debian.org
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	[thread overview]
Message-ID: <20080323155420.GA14910@scowler.net> (raw)
In-Reply-To: <87ve40wvkk.fsf@vorlon.ganneff.de>

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


           reply	other threads:[~2008-03-23 15:54 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <87ve40wvkk.fsf@vorlon.ganneff.de>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080323155420.GA14910@scowler.net \
    --to=schizo@debian.org \
    --cc=469588@bugs.debian.org \
    --cc=joerg@debian.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).