From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21979 invoked by alias); 12 Nov 2016 01:03:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39921 Received: (qmail 1194 invoked from network); 12 Nov 2016 01:03:54 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com 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(66.111.4.28):SA:0(-0.7/5.0):. Processed in 1.455291 secs); 12 Nov 2016 01:03:54 -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=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=jwCkJUaQXiKv30MrnT+g2znLv3w=; b=W99nK/ A+k4cIDACWe5RakjjIg5yslOSBkNY6Ez+RBpzRlOVlLHZcD1PnIBIcXolamNHdRs 5SsAX06EJYJZN8kP/D3AYHRAf/nUzExgYVMcL1aGTPnoLgWerdgvo6arweSRk+rA 8FrdRH2OuRaZymo4DQnQmjLTMcL2e1KXljLdU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=jwCkJUaQXiKv30MrnT+g2znLv3w=; b=ugZs1 a8YXu8sbVbvMi43mxhnyH/3xfuV0FiUSzYXU30ejbPVOPlBp4v96nfTi7gqiyJeW q7twFv5jF+ygfio70ZpPCBfS4wctdt8Z3qMBHvL3xEleNDZiaFEZYHeLwo6/jAYE fjbWnw4Xkg/L0wI4qHcnh+rDTxQIdT7O/AZ3vU= X-ME-Sender: X-Sasl-enc: yhVV1kv/zNbSdFdp8YTn/2o3T7TRUsw6VLS+m3lOjp46 1478912628 From: Daniel Shahaf To: zsh-workers@zsh.org Cc: Daniel Hahler Subject: [PATCH 2/2] __git_recent_branches: Remove erroneous parsing of partial ref names as tags. Date: Sat, 12 Nov 2016 01:01:29 +0000 Message-Id: <1478912489-23490-2-git-send-email-danielsh@fujitsu.shahaf.local2> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478912489-23490-1-git-send-email-danielsh@fujitsu.shahaf.local2> References: <1478912489-23490-1-git-send-email-danielsh@fujitsu.shahaf.local2> In the reflog, partial ref names in the "from" field always represent names of heads. (That is not true for the "to" field.) The parsing of tag names was added in commit 39102 (317c96b64f43688a6be08a8b1c93b6ab4eed662c) for equivalence with the then-previous implementation which used `git log $partial_ref_name`. The equivalence was correct, however, the then-previous implementation was not, since it would consider $partial_ref_name as a refs/tags/ name if a refs/heads/ name did not exist. --- Completion/Unix/Command/_git | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 94457fc..4dba93b 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6079,7 +6079,7 @@ __git_recent_branches() { local -a branches local -A descriptions local -a reply - local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/ refs/tags/')"}"#refs/(heads|tags)/} ) + local -aU valid_ref_names_munged=( ${"${(f)"$(_call_program valid-ref-names 'git for-each-ref --format="%(refname)" refs/heads/')"}"#refs/heads/} ) # 1. Obtain names of recently-checked-out branches from the reflog. # 2. Remove ref names that that no longer exist from the list. @@ -6096,13 +6096,13 @@ __git_recent_branches() { # 4. Obtain log messages for all of them in one shot. # TODO: we'd really like --sort=none here... but git doesn't support such a thing. # The \n removal is because for-each-ref prints a \n after each entry. - descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} refs/tags/${(q)^branches} "--")"//$'\n'} ) + descriptions=( ${(0)"$(_call_program all-descriptions "git --no-pager for-each-ref --format='%(refname)%00%(subject)%00'" refs/heads/${(q)^branches} "--")"//$'\n'} ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions local branch for branch in ${branches} ; do - branches_colon_descriptions+="${branch//:/\:}:${(v)descriptions[(I)(refs/heads/|refs/tags/)${(b)branch}]}" + branches_colon_descriptions+="${branch//:/\:}:${descriptions[refs/heads/${(b)branch}]}" done _describe -V -t recent-branches "recent branches" branches_colon_descriptions