Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 2/3] Completion/Unix/Command/_git: fix shortlog completer
- X-seq: zsh-workers 31288
- From: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
- To: ZSH Workers <zsh-workers@xxxxxxx>
- Subject: [PATCH 2/3] Completion/Unix/Command/_git: fix shortlog completer
- Date: Sat, 20 Apr 2013 18:26:12 +0530
- Cc: Clint Adams <clint@xxxxxxxxxxxxxxxxxxxxx>, Frank Terbeck <bewater@xxxxxxxxxxxxxxxxxxxxx>, Nikolai Weibull <pcppopper@xxxxxxxxxxxxxxxxxxxxx>
- 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==
- In-reply-to: <1366462573-15545-1-git-send-email-artagnon@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- 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 <artagnon@xxxxxxxxx>
---
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author