From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19792 invoked by alias); 18 Jul 2015 22:19:08 -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: 35821 Received: (qmail 7377 invoked from network); 18 Jul 2015 22:19:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=oP2e2iUKp5wrv+pgMBKXpRFAQcqiEN9iwcTJNWi4Fwo=; b=AKq1OIskwVu77B0yBzlH9heGMRswPy5RHzulUMWGYN+lsNhzlzwcHpOeqWJNyG0yL/ dVsNfY5nj2RFv/oH8njlz2Y9U+tLKO2E7ACnuUP2KllQ0HO6Y+xOMASTeE2iMsw5XlRy KYtMXInsp0cdvLBvWknz6lIm/qVa0K7KwO/rjnMr8CUwEjdRFhL/T0XD3uYEokzxUoK0 Jk7lfigPquRs1YT34k5VzD682233gm0IDwhHA1J5R+eM1IlpvPgNyuVhzFlpVfMMksUW ofCDDRPvuo4Gs2ezQDOX+DG1nTe+hLDyjnyWHQKKigaxPvC49zfdydJVlEeFIz5vADOw 7hJQ== MIME-Version: 1.0 X-Received: by 10.55.20.24 with SMTP id e24mr35965537qkh.35.1437257945380; Sat, 18 Jul 2015 15:19:05 -0700 (PDT) Date: Sat, 18 Jul 2015 23:19:05 +0100 Message-ID: Subject: PATCH: 3.0.8: git completion update for cherry-pick From: Mateusz Karbowy To: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Currently completion for cherry-pick displays recent commits from the current branch. This patch changes this to show recent commits from all branches except HEAD. Obszczymucha diff --git a/_git b/_git index b8edc10..8b9eb2b 100644 --- a/_git +++ b/_git @@ -511,7 +511,7 @@ _git-cherry-pick () { '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ - ': :__git_commit_ranges' + ': :__git_commit_ranges --all --not HEAD' } (( $+functions[_git-citool] )) || @@ -5602,20 +5602,20 @@ __git_remote_branch_names_noprefix () { (( $+functions[__git_commit_objects_prefer_recent] )) || __git_commit_objects_prefer_recent () { - __git_recent_commits || __git_commit_objects + __git_recent_commits $* || __git_commit_objects } (( $+functions[__git_commits] )) || __git_commits () { # TODO: deal with things that __git_heads and __git_tags has in common (i.e., # if both exists, they need to be completed to heads/x and tags/x. - local -a sopts ropt - zparseopts -E -a sopts S: r:=ropt R: q + local -a sopts ropt recentopts + zparseopts -E -a sopts S: r:=ropt R: q -all=recentopts -not+:=recentopts sopts+=( $ropt:q ) _alternative \ "heads::__git_heads $sopts" \ "commit-tags::__git_commit_tags $sopts" \ - 'commit-objects::__git_commit_objects_prefer_recent' + "commit-objects::__git_commit_objects_prefer_recent $recentopts" } (( $+functions[__git_heads] )) || @@ -5669,14 +5669,16 @@ __git_commit_objects () { (( $+functions[__git_recent_commits] )) || __git_recent_commits () { - local gitdir expl start + local gitdir expl start opts declare -a descr tags heads commits local i j k ret integer distance_from_head + zparseopts -D -E -a opts -- -all -not: + # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}") + commits=("${(f)"$(_call_program commits git --no-pager log $opts -20 --format='%h%n%d%n%s\ \(%cr\)')"}") __git_command_successful $pipestatus || return 1 for i j k in "$commits[@]" ; do