f3fa41834d9c954ee2d352c6c5b60d72f7a93593
- 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/README.md b/plugins/git-extras/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..8f12e297ec42793a69fad27a5d09629c465a8f00
4--- /dev/null
5+++ b/plugins/git-extras/README.md
6@@ -0,0 +1,11 @@
7+# git-extras
8+
9+This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
10+
11+## Setup notes
12+
13diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
14index d91c1af81c6391c17249449e8cd5bc554201a73a..681fbb466a66f6563a457f0384edebb8102f0c5b 100644
15--- a/plugins/git-extras/git-extras.plugin.zsh
16+++ b/plugins/git-extras/git-extras.plugin.zsh
17@@ -1,10 +1,13 @@
18-#compdef git
19 # ------------------------------------------------------------------------------
20 # Description
21 # -----------
22 #
23 # Completion script for git-extras (http://github.com/tj/git-extras).
24 #
25+# This depends on and reueses some of the internals of the _git completion
26+# function that ships with zsh itself. It will not work with the _git that ships
27+# with git.
28+#
29 # ------------------------------------------------------------------------------
30 # Authors
31 # -------
32@@ -22,16 +25,18 @@
33 # ------------------------------------------------------------------------------
34
35
36-__git_command_successful () {
37- if (( ${#pipestatus:#0} > 0 )); then
38- _message 'not a git repository'
39- return 1
40- fi
41- return 0
42-}
43+# Internal functions
44+# These are a lot like their __git_* equivalents inside _git
45
46+__gitex_command_successful () {
47+ if (( ${#*:#0} > 0 )); then
48+ _message 'not a git repository'
49+ return 1
50+ fi
51+ return 0
52+}
53
54-__git_commits() {
55+__gitex_commits() {
56 declare -A commits
57 git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
58 do
59@@ -42,7 +47,7 @@ __git_commits() {
60 _describe -t commits commit commits && ret=0
61 }
62
63-__git_tag_names() {
64+__gitex_tag_names() {
65 local expl
66 declare -a tag_names
67 tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
68@@ -51,7 +56,7 @@ __git_tag_names() {
69 }
70
71
72-__git_branch_names() {
73+__gitex_branch_names() {
74 local expl
75 declare -a branch_names
76 branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
77@@ -59,7 +64,7 @@ __git_branch_names() {
78 _wanted branch-names expl branch-name compadd $* - $branch_names
79 }
80
81-__git_specific_branch_names() {
82+__gitex_specific_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/"$1" 2>/dev/null)"}#refs/heads/$1/})
86@@ -67,32 +72,28 @@ __git_specific_branch_names() {
87 _wanted branch-names expl branch-name compadd $* - $branch_names
88 }
89
90-
91-__git_feature_branch_names() {
92- __git_specific_branch_names 'feature'
93+__gitex_feature_branch_names() {
94+ __gitex_specific_branch_names 'feature'
95 }
96
97-
98-__git_refactor_branch_names() {
99- __git_specific_branch_names 'refactor'
100+__gitex_refactor_branch_names() {
101+ __gitex_specific_branch_names 'refactor'
102 }
103
104-
105-__git_bug_branch_names() {
106- __git_specific_branch_names 'bug'
107+__gitex_bug_branch_names() {
108+ __gitex_specific_branch_names 'bug'
109 }
110
111-
112-__git_submodule_names() {
113+__gitex_submodule_names() {
114 local expl
115 declare -a submodule_names
116- submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})