about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2014-02-20 01:11:28 +0100
committerOliver Kiddle <opk@zsh.org>2014-02-25 08:59:20 +0100
commit079540cc7859ad73c0ccfb6db8ad3aa138037925 (patch)
tree98e335f4799161893686705b6d6fe02efb0a63b1
parentafe7ff6b5dc6e979aae1695635349a33468f7d12 (diff)
downloadzsh-079540cc7859ad73c0ccfb6db8ad3aa138037925.tar.gz
zsh-079540cc7859ad73c0ccfb6db8ad3aa138037925.tar.xz
zsh-079540cc7859ad73c0ccfb6db8ad3aa138037925.zip
users/18485: add .. as an auto-removable suffix in git revision ranges
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6827f5ec0..f9e7f1690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-24  Oliver Kiddle <opk@zsh.org>
+
+	* users/18485: Completion/Unix/Command/_git: add .. as an
+	auto-removable suffix in git revision ranges
+
 2014-02-24  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* Sebastien Alaiwan: 32462: Completion/Unix/Command/_bzr:
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index a2cbf74d0..b082bb050 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5526,9 +5526,12 @@ __git_remote_branch_names_noprefix () {
 __git_commits () {
   # TODO: deal with things that __git_heads and __git_tags has in common (i.e.,
   # if both exists, they need to be completed to heads/x and tags/x.
+  local -a sopts ropt
+  zparseopts -E -a sopts S: r:=ropt R: q
+  sopts+=( $ropt:q )
   _alternative \
-    'heads::__git_heads' \
-    'commit-tags::__git_commit_tags' \
+    "heads::__git_heads $sopts" \
+    "commit-tags::__git_commit_tags $sopts" \
     'commit-objects::__git_commit_objects'
 }
 
@@ -5595,10 +5598,12 @@ __git_commits2 () {
 
 (( $+functions[__git_commit_ranges] )) ||
 __git_commit_ranges () {
+  local -a suf
   if compset -P '*..(.|)'; then
     __git_commits $*
   else
-    __git_commits $* -qS ..
+    compset -S '..*' || suf=( -qS .. -r '.@~ ^:' )
+    __git_commits $* $suf
   fi
 }