4bd6c43cfba17b6d13cd2f3b8f849ae3226e76e9
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
2index 8419166abc10b7f05a30fe02d39aa34d3c33cddb..d91c1af81c6391c17249449e8cd5bc554201a73a 100644
3--- a/plugins/git-extras/git-extras.plugin.zsh
4+++ b/plugins/git-extras/git-extras.plugin.zsh
5@@ -3,19 +3,20 @@
6 # Description
7 # -----------
8 #
9-# Completion script for git-extras (http://github.com/visionmedia/git-extras).
10+# Completion script for git-extras (http://github.com/tj/git-extras).
11 #
12 # ------------------------------------------------------------------------------
13 # Authors
14 # -------
15 #
16 # * Alexis GRIMALDI (https://github.com/agrimaldi)
17+# * spacewander (https://github.com/spacewander)
18 #
19 # ------------------------------------------------------------------------------
20 # Inspirations
21 # -----------
22 #
23-# * git-extras (http://github.com/visionmedia/git-extras)
24+# * git-extras (http://github.com/tj/git-extras)
25 # * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
26 #
27 # ------------------------------------------------------------------------------
28@@ -30,10 +31,21 @@ __git_command_successful () {
29 }
30
31
32+__git_commits() {
33+ declare -A commits
34+ git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
35+ do
36+ hash=$(echo $commit | cut -d':' -f1)
37+ commits[$hash]="$commit"
38+ done
39+ local ret=1
40+ _describe -t commits commit commits && ret=0
41+}
42+
43 __git_tag_names() {
44 local expl
45 declare -a tag_names
46- tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
47+ tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
48 __git_command_successful || return
49 _wanted tag-names expl tag-name compadd $* - $tag_names
50 }
51@@ -47,31 +59,27 @@ __git_branch_names() {
52 _wanted branch-names expl branch-name compadd $* - $branch_names
53 }
54
55-
56-__git_feature_branch_names() {
57+__git_specific_branch_names() {
58 local expl
59 declare -a branch_names
60- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
61+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
62 __git_command_successful || return
63 _wanted branch-names expl branch-name compadd $* - $branch_names
64 }
65
66
67+__git_feature_branch_names() {
68+ __git_specific_branch_names 'feature'
69+}
70+
71+
72 __git_refactor_branch_names() {
73- local expl
74- declare -a branch_names
75- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
76- __git_command_successful || return
77- _wanted branch-names expl branch-name compadd $* - $branch_names
78+ __git_specific_branch_names 'refactor'
79 }
80
81
82 __git_bug_branch_names() {
83- local expl
84- declare -a branch_names
85- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
86- __git_command_successful || return
87- _wanted branch-names expl branch-name compadd $* - $branch_names
88+ __git_specific_branch_names 'bug'
89 }
90
91
92@@ -92,19 +100,43 @@ __git_author_names() {
93 _wanted author-names expl author-name compadd $* - $author_names
94 }
95
96+# subcommands
97
98-_git-changelog() {
99- _arguments \
100- '(-l --list)'{-l,--list}'[list commits]' \
101+_git-bug() {
102+ local curcontext=$curcontext state line ret=1
103+ declare -A opt_args
104+