summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_git
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2013-04-20 18:26:12 +0530
committerFrank Terbeck <ft@bewatermyfriend.org>2013-04-25 14:36:08 +0200
commit2ea9cd47752de9bd5b791c9394b3f625a35db3c2 (patch)
tree25da0da1600784c3637f4ba26c3ec7bcc986cb79 /Completion/Unix/Command/_git
parentcbdedcfbfe6d6cd2320ce185ded5c8b2596b61db (diff)
downloadzsh-2ea9cd47752de9bd5b791c9394b3f625a35db3c2.tar.gz
zsh-2ea9cd47752de9bd5b791c9394b3f625a35db3c2.zip
31288: _git: fix shortlog completer
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@gmail.com>
Diffstat (limited to 'Completion/Unix/Command/_git')
-rw-r--r--Completion/Unix/Command/_git27
1 files changed, 26 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 5d0f8c5a8..db59a9b75 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