Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Fix a typo in _git.
- X-seq: zsh-workers 25470
- From: Clint Adams <clint@xxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: Fix a typo in _git.
- Date: Sun, 17 Aug 2008 17:13:21 +0000
- Cc: zsh-workers <zsh-workers@xxxxxxxxxx>
- In-reply-to: <237967ef0808151656j7787f169g4b3456910e05bfc2@xxxxxxxxxxxxxx>
- Mail-followup-to: Mikael Magnusson <mikachu@xxxxxxxxx>, zsh-workers <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <237967ef0808151656j7787f169g4b3456910e05bfc2@xxxxxxxxxxxxxx>
On Sat, Aug 16, 2008 at 01:56:36AM +0200, Mikael Magnusson wrote:
> http://git.mika.l3ib.org/?p=zsh-cvs.git;a=history;f=Completion/Unix/Command/_git;h=mika
Not committing this one; what's the advantage of for-each-ref and why
aren't you using _call_program?
From: Mikael Magnusson <mikachu@xxxxxxxxx>
Date: Fri, 6 Jun 2008 02:24:23 +0000 (+0200)
Subject: Use git-for-each-ref instead of git-branch/tag.
X-Git-Url: http://git.mika.l3ib.org:1234/?p=zsh-cvs.git;a=commitdiff_plain;h=48535f35f07a878630fb1aab122429dae8f95383
Use git-for-each-ref instead of git-branch/tag.
---
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 974cb6c..f1261ab 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -2902,7 +2902,8 @@ __git_heads () {
local expl
declare -a branch_names
- branch_names=(${${(f)"$(_call_program heads git branch --no-color -a 2>/dev/null)"}#[* ] })
+ branch_names=(${${(f)"$(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
@@ -2913,7 +2914,7 @@ __git_tags () {
local expl
declare -a tag_names
- tag_names=(${${(f)"$(_call_program tags git tag -l 2>/dev/null)"}#[* ] })
+ tag_names=(${${(f)"$(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
@@ -2966,7 +2967,7 @@ __git_branch_names () {
local expl
declare -a branch_names
- branch_names=(${${(f)"$(_call_program branch-names git branch --no-color 2>/dev/null)"}#[* ] })
+ branch_names=(${${(f)"$(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