summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Terbeck <ft@bewatermyfriend.org>2011-07-01 10:06:41 +0200
committerFrank Terbeck <ft@bewatermyfriend.org>2011-07-01 10:06:41 +0200
commit4a753fc3430c511f7020b454fcce1ba9c54280b5 (patch)
tree5bdd2aca2ab041722c55226dcfed441cb1a66bcf
parentc63c0d798c350532a385b4834213d67274bb18e8 (diff)
downloadzsh-4a753fc3430c511f7020b454fcce1ba9c54280b5.tar.gz
zsh-4a753fc3430c511f7020b454fcce1ba9c54280b5.zip
Include _git patches from upstream (Closes: #630906)
The included patches enable fallback to file name completion for unknown sub-commands as well as the registration of addon completions such as _git-buildpackage.
-rw-r--r--debian/patches/0001_git_updates.diff112
-rw-r--r--debian/patches/series1
2 files changed, 113 insertions, 0 deletions
diff --git a/debian/patches/0001_git_updates.diff b/debian/patches/0001_git_updates.diff
new file mode 100644
index 000000000..c141c002c
--- /dev/null
+++ b/debian/patches/0001_git_updates.diff
@@ -0,0 +1,112 @@
+This is an update for the _git completion. It's actually a number of patches
+squashed into one:
+
+ <http://www.zsh.org/mla/workers/2011/msg00952.html>
+ <http://www.zsh.org/mla/workers/2011/msg00953.html>
+ <http://www.zsh.org/mla/workers/2011/msg00955.html>
+ <http://www.zsh.org/mla/workers/2011/msg00961.html>
+
+Diffstat:
+
+ _git | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 65 insertions(+), 1 deletion(-)
+
+These are included to fix `#630906'. All of them are included upstream.
+
+
+Index: pkg-zsh/Completion/Unix/Command/_git
+===================================================================
+--- pkg-zsh.orig/Completion/Unix/Command/_git 2011-07-01 09:58:04.000000000 +0200
++++ pkg-zsh/Completion/Unix/Command/_git 2011-07-01 09:58:04.000000000 +0200
+@@ -17,6 +17,16 @@
+ #
+ # You could even create a function _git-foo() to handle specific completion
+ # for that command.
++#
++# When _git does not know a given sub-command (say `bar'), it falls back to
++# completing file names for all arguments to that sub command. I.e.:
++#
++# % git bar <tab>
++#
++# ...will complete file names. If you do *not* want that fallback to be used,
++# use the `use-fallback' style like this:
++#
++# % zstyle ':completion:*:*:git*:*' use-fallback false
+
+ # TODO: There is still undocumented configurability in here.
+
+@@ -4603,6 +4613,15 @@
+ _describe -t plumbing-sync-commands 'plumbing sync command' plumbing_sync_commands && ret=0
+ _describe -t plumbing-sync-helper-commands 'plumbing sync helper command' plumbing_sync_helper_commands && ret=0
+ _describe -t plumbing-internal-helper-commands 'plumbing internal helper command' plumbing_internal_helper_commands && ret=0
++ local -a addons
++ local a
++ for a in $_git_third_party; do
++ (( ${+commands[git-${a%%:*}]} )) && addons+=( $a )
++ done
++ _describe -t third-party-addons 'third party addon' addons && ret=0
++ local -a user_commands
++ zstyle -a ":completion:${curcontext}:" user-commands user_commands || user_commands=()
++ _describe -t user-specific-commands 'user specific command' user_commands && ret=0
+ return ret
+ }
+
+@@ -6023,7 +6042,14 @@
+ (option-or-argument)
+ curcontext=${curcontext%:*:*}:git-$words[1]:
+
+- _call_function ret _git-$words[1]
++ if (( ${+functions[_git-$words[1]]} )); then
++ _git-$words[1]
++ elif zstyle -T ":completion:${curcontext}:" use-fallback; then
++ _path_files
++ ret=$?
++ else
++ _message 'Unknown sub-command'
++ fi
+ ;;
+ esac
+ else
+@@ -6032,4 +6058,42 @@
+ return ret
+ }
+
++# Handle add-on completions. Say you got a third party add-on `foo'. What you
++# want to do is write your completion as `_git-foo' and this code will pick it
++# up. That should be a regular compsys function, which starts like this:
++#
++# #compdef git-foo
++#
++# In addition to what compinit does, this also reads the second line of the
++# completion. If that matches "#desc:*" the part behind "#desc:" will be used
++# as the addon's description. Like this:
++#
++# #desc:checks git's foobar value
++local addon input i desc
++typeset -gUa _git_third_party
++for addon in ${^fpath}/_git-*~*~(.N); do
++ if [[ -n ${(M)_git_third_party:#${${addon:t}#_git-}*} ]]; then
++ # This makes sure only the first _git-foo in $fpath gets read.
++ continue
++ fi
++ # Read the second line of the file.
++ i=1
++ desc=
++ while read input; do
++ if (( i == 2 )); then
++ desc=$input
++ break
++ fi
++ (( i++ ))
++ done < $addon
++ # Setup `$desc' appropriately.
++ if [[ $desc != '#desc:'* ]]; then
++ desc=
++ else
++ desc=${desc#\#desc}
++ fi
++ # Add the addon's completion.
++ _git_third_party+=( ${${addon:t}#_git-}$desc )
++done
++
+ _git
diff --git a/debian/patches/series b/debian/patches/series
index ac1e7612f..f03b809a5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
deb_0000_at_configure.diff
deb_0001_at_config_h_in.diff
0000_apt_markauto.diff
+0001_git_updates.diff