Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: git completion problems
- X-seq: zsh-users 23484
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Will Gray <graywh@xxxxxxxxx>
- Subject: Re: git completion problems
- Date: Wed, 13 Jun 2018 18:16:49 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1528906622; bh=VBY1wTexGjcz/slMjYnbmwEr2D1ODYD+tJNMCA0v/kw=; h=From:References:To:Subject:Date:From:Subject; b=pKRWRdz5Kvzbc0lVs2x6vfMRjEkpK8/iUrY5xxrAVb7rzARq0QluZ9ZciidtFFP8EbFLk6x6IBzGnR4lOW23+7HirizNDzOeXIJo+GYU5psZAmXAXPHHjKpcrc5YmeHqiQf6rwNgtgyWowcrl7nY0wfm2o5AF3TaoBQHq9BEeyiLykV8Du2CFGSjfOXGP9gfBJGAf0pVgzvKf9nQ85b83HDjpYafyT/PC/X7zieV0x7AuE9CeZyj4/sbIHNfLcR0sJoN3xn2b80Hx26DiU0C8CfUyaB57sHRAL/cvTswOKBM9l4yI6n3QZB/WwZ1h3n0KYy7zNETxpBVAJENLXnz4A==
- In-reply-to: <CAKAhaHoSV2XuAM3bErDwn3ttJv_tc8-n5Y6dGfZai7+fJ9LOqQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKAhaHoSV2XuAM3bErDwn3ttJv_tc8-n5Y6dGfZai7+fJ9LOqQ@mail.gmail.com>
On 12 Dec, Will Gray wrote:
> I have three remote branches: "origin/master", "origin/production",
> and "origin/production-dev". When I enter "o", it will complete
> "origin". If I add "/pr", it will not complete "origin/production".
> However, if I enter "o/pr" it will complete "origin/production".
>
> I'm using Zsh 5.1.1 and have downloaded the latest
> Completion/Unix/_git to first entry in my $path.
Sorry, that this didn't get looked at sooner. It arrived at a time when I
was fairly busy.
I think this is caused by essentially the same set of matches - the
branches - getting added more than once with different matching control
specs. They get added once with "r:|/=* r:|=*", once with no match spec
and there's also a call to _multi_parts for file completion thrown into
the mix. It'd be good to know if the following patch fixes the issue for
you. Given certain matcher style settings, it may not. This just makes
it more consistent.
Oliver
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 8297d6424..f9e6a76e1 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5629,7 +5629,7 @@ __git_describe_branch () {
(( $+functions[__git_describe_commit] )) ||
__git_describe_commit () {
- __git_describe_branch $1 $2 $3 -M 'r:|/=**' "${(@)argv[4,-1]}"
+ __git_describe_branch $1 $2 $3 -M 'r:|/=* r:|=*' "${(@)argv[4,-1]}"
}
# Completion Wrappers
@@ -6546,7 +6546,7 @@ __git_recent_commits () {
expl=()
_wanted commit-tags expl 'commit tag' compadd "$@" -a - tags && ret=0
expl=()
- _wanted heads expl 'head' compadd "$@" -a - heads && ret=0
+ _wanted heads expl 'head' compadd -M "r:|/=* r:|=*" "$@" -a - heads && ret=0
return $ret
}
@@ -6671,7 +6671,7 @@ __git_tags () {
tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
__git_command_successful $pipestatus || return 1
- _wanted tags expl tag compadd -M 'r:|/=**' "$@" -a - tags
+ _wanted tags expl tag compadd -M 'r:|/=* r:|=*' "$@" -a - tags
}
(( $+functions[__git_commit_tags] )) ||
@@ -6694,7 +6694,7 @@ __git_tags_of_type () {
tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/})
__git_command_successful $pipestatus || return 1
- _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags
+ _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -a - tags
}
# Reference Argument Types
@@ -6717,7 +6717,7 @@ __git_references () {
_git_refs_cache_pwd=$PWD
fi
- _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_refs_cache
+ _wanted references expl 'reference' compadd -M 'r:|/=* r:|=*' -a - _git_refs_cache
}
# ### currently unused; are some callers of __git_references supposed to call this function?
@@ -6731,7 +6731,7 @@ __git_local_references () {
_git_local_refs_cache_pwd=$PWD
fi
- _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_local_refs_cache
+ _wanted references expl 'reference' compadd -M 'r:|/=* r:|=*' -a - _git_local_refs_cache
}
(( $+functions[__git_remote_references] )) ||
Messages sorted by:
Reverse Date,
Date,
Thread,
Author