From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27837 invoked by alias); 13 Jun 2018 16:17:11 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23484 Received: (qmail 11479 invoked by uid 1010); 13 Jun 2018 16:17:11 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(205.235.26.22):SA:0(-1.4/5.0):. Processed in 1.189703 secs); 13 Jun 2018 16:17:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=GVfX=I7=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 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+GYU5psZAmXAXPHHjKpcrc5YmeHqiQf6rw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312sAMGM5wRJXgFCJwQctPRkt1C4al6Gd25yEC32JcLNBy68f R0ABAYdQunmjTzhs5TF4pLdBNGmQ3TTeYJda48lSfQJ6rJcM8o_OheNIRSQZJSkd1i7XsaGf0u_M - cc: zsh-users@zsh.org In-reply-to: From: Oliver Kiddle References: To: Will Gray Subject: Re: git completion problems MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <698.1528906609.1@thecus> Date: Wed, 13 Jun 2018 18:16:49 +0200 Message-ID: <699.1528906609@thecus> 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] )) ||