From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27763 invoked by alias); 20 Apr 2013 12:56:42 -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: 31288 Received: (qmail 28800 invoked from network); 20 Apr 2013 12:56:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.220.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=N6Rh9mB/HCK2lxgKOZiGzO+pbW2CustdtKJQd5jjOww=; b=CExIv4wyQUq11tR1xIADfMhWY1JmQWsA2DD24m0vXiLQydXc7iZya4UIpXweee1CR6 U1Ijuo0Sg3HKXeBqJO/BI0tb+javsPDQwXn2AIGjty723GqJx4tpr1lLG6eBn8mou+Zp OwZDUGPdpS2bm2TC1tN7DKPGVDThVx/bMf4rQqAwJYjcAedS40DwqrumbRYqmZivB0HO 6lfZ4ueyDJdqAPkcs/w/XPz+dEWwuETWIYII9d2Y6qgr9UCwdmLRUnJt9n9Zt6vNtxVZ Zhl66E0PIYbpcSmjiSt4s5CuO0lxQbtUX8dimqYi04ucKkt/wysnlp4h9hBcjQNuCFeL IGNg== X-Received: by 10.66.138.109 with SMTP id qp13mr3769533pab.127.1366462585930; Sat, 20 Apr 2013 05:56:25 -0700 (PDT) From: Ramkumar Ramachandra To: ZSH Workers Cc: Clint Adams , Frank Terbeck , Nikolai Weibull Subject: [PATCH 2/3] Completion/Unix/Command/_git: fix shortlog completer Date: Sat, 20 Apr 2013 18:26:12 +0530 Message-Id: <1366462573-15545-3-git-send-email-artagnon@gmail.com> X-Mailer: git-send-email 1.8.2.1.506.gbce9ff0 In-Reply-To: <1366462573-15545-1-git-send-email-artagnon@gmail.com> References: <1366462573-15545-1-git-send-email-artagnon@gmail.com> Currently, __git-shortlog () says that 'git shortlog' can only accept commits as arguments (probably because the official documentation says this). This is entirely untrue: shortlog can accept commit-range-or-file, just like log can. Fix the completer by copying out segments from the __git-log () function. Signed-off-by: Ramkumar Ramachandra --- Completion/Unix/Command/_git | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f1753aa..38b1d80 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1298,7 +1298,8 @@ _git-shortlog () { '(-e --email)'{-e,--email}'[show email addres of each author]' \ '-w-[linewrap the output]:: :->wrap' \ $revision_options \ - '*: :__git_commits' && ret=0 + '(-)--[start file arguments]' \ + '*:: :->commit-range-or-file' && ret=0 case $state in (wrap) @@ -1314,6 +1315,30 @@ _git-shortlog () { __git_guard_number 'line width' fi ;; + (commit-range-or-file) + case $CURRENT in + (1) + if [[ -n ${opt_args[(I)--]} ]]; then + __git_cached_files && ret=0 + else + _alternative \ + 'commit-ranges::__git_commit_ranges' \ + 'cached-files::__git_cached_files' && ret=0 + fi + ;; + (*) + # TODO: Write a wrapper function that checks whether we have a + # committish range or comittish and calls __git_tree_files + # appropriately. + if __git_is_committish_range $line[1]; then + __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 + elif __git_is_committish $line[1]; then + __git_tree_files ${PREFIX:-.} $line[1] && ret=0 + else + __git_cached_files && ret=0 + fi + ;; + esac esac return ret -- 1.8.2.1.506.gbce9ff0