Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Fix a typo in _git.



On Sun, Aug 17, 2008 at 07:27:31PM +0200, Mikael Magnusson wrote:
> git branch is a UI command, it's not guaranteed to always indicate the current
> branch with a * for example. It also doesn't tell you if a branch is
> in refs/heads
> or refs/remotes. The completion doesn't differentiate between those yet, but
> it definitely should, I don't think I'll be able to fix that though.
> 
> As for _call_program, I don't really know what the purpose of that is. I don't
> have a reason for not using it though.

       _call_program tag string ...
              This function provides a mechanism for the user to over‐
              ride  the  use  of an external command.  It looks up the
              command style with the supplied tag.  If  the  style  is
              set,  its  value is used as the command to execute.  The
              strings from the call  to  _call_program,  or  from  the
              style  if set, are concatenated with spaces between them
              and the resulting string is evaluated.  The return  sta‐
              tus is the return status of the command called.


> You have the same broken reply-to as the other guy, which means you
> won't be in the to: field, and i have to remove myself manually each
> time.
> Either that, or gmail is doing something non-standard.

You might mean Mail-Followup-To.

This changes the _call_program tags since the outputs are incompatible;
anyone with styles set for these will have them silently stop working.

Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.75
diff -u -r1.75 _git
--- Completion/Unix/Command/_git	17 Aug 2008 14:05:59 -0000	1.75
+++ Completion/Unix/Command/_git	18 Aug 2008 01:44:40 -0000
@@ -2966,7 +2966,7 @@
   local expl
   declare -a branch_names
 
-  branch_names=(${${(f)"$(_call_program heads git branch --no-color -a 2>/dev/null)"}#[* ] })
+  branch_names=(${${(f)"$(_call_program headrefs git for-each-ref --format='%(refname)' refs/heads refs/remotes 2>/dev/null)"}#refs/(heads|remotes)/})
   __git_command_successful || return
 
   _wanted heads expl branch-name compadd $* - $branch_names HEAD
@@ -2977,7 +2977,7 @@
   local expl
   declare -a tag_names
 
-  tag_names=(${${(f)"$(_call_program tags git tag -l 2>/dev/null)"}#[* ] })
+  tag_names=(${${(f)"$(_call_program tagrefs git for-each-ref --format='%(refname)' refs/tags 2>/dev/null)"}#refs/tags/})
   __git_command_successful || return
 
   _wanted tags expl tag-name compadd $* - $tag_names
@@ -3030,7 +3030,7 @@
   local expl
   declare -a branch_names
 
-  branch_names=(${${(f)"$(_call_program branch-names git branch --no-color 2>/dev/null)"}#[* ] })
+  branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='%(refname)' refs/heads 2>/dev/null)"}#refs/heads/})
   __git_command_successful || return
 
   _wanted branch-names expl branch-name compadd $* - $branch_names



Messages sorted by: Reverse Date, Date, Thread, Author