From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21235 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: 39922 Received: (qmail 15327 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 2.067518 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:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=72j YGIri1NtbSu5dCekvuUFjt3A=; b=OSsdmm77akH0KdjbVLftqNPpjdM7G1nVaRS cxffRnfHekeQdknNumGWy+VSkahxRnqb0GRgD86BzmHZ9iPfDF2s84soRiZVR433 pwZzZ0IwAsv5tOJ51JsOwbSKmR56Gip/Mmb1LLgzm81FybpUA/gB9sC0615s8L05 TNkLjaxI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=72 jYGIri1NtbSu5dCekvuUFjt3A=; b=RHRGMoYInudP9qjy9XRGo9ya/BV+Bc7zuz QJgajSlDVoqksLBRCXsppLkE5O8Dpm/a+kUyiBmSAPbuv9pyNLiSn5NAbZ4HMLCT +qgG/XMcGqhdfZRdi8sRml2BbGceTZd/fqBsB/UbYNqX9FR7HqwXX0mJVH8RIStv jl+63SzQg= X-ME-Sender: X-Sasl-enc: 8el0OXoH08zgPEcloVlv47WH1oibHRUb7lq/BYHsvidV 1478912626 From: Daniel Shahaf To: zsh-workers@zsh.org Cc: Daniel Hahler Subject: [PATCH 1/2] __git_recent_branches: Fix an 'assertion' failure when two branches (refs) point to the same commit. Date: Sat, 12 Nov 2016 01:01:28 +0000 Message-Id: <1478912489-23490-1-git-send-email-danielsh@fujitsu.shahaf.local2> X-Mailer: git-send-email 2.1.4 --- Found by Daniel Hahler. __git_recent_branches() is not called by _git (for the time being). Cheers, Daniel Completion/Unix/Command/_git | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 17a7b1e..94457fc 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -6076,7 +6076,8 @@ __git_recent_branches__names() (( $+functions[__git_recent_branches] )) || __git_recent_branches() { - local -a branches descriptions + 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)/} ) @@ -6093,19 +6094,15 @@ __git_recent_branches() { fi # 4. Obtain log messages for all of them in one shot. - descriptions=( ${(f)"$(_call_program all-descriptions git --no-pager log --no-walk=unsorted --pretty=%s ${(q)branches} --)"} ) - - if (( $#branches != $#descriptions )); then - # ### Trouble... - zle -M "__git_recent_branches: \$#branches != \$#descriptions" - return 1 - fi + # 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'} ) # 5. Synthesize the data structure _describe wants. local -a branches_colon_descriptions - local branch description - for branch description in ${branches:^descriptions} ; do - branches_colon_descriptions+="${branch//:/\:}:${description}" + local branch + for branch in ${branches} ; do + branches_colon_descriptions+="${branch//:/\:}:${(v)descriptions[(I)(refs/heads/|refs/tags/)${(b)branch}]}" done _describe -V -t recent-branches "recent branches" branches_colon_descriptions