about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Base/Utility/_describe35
-rw-r--r--Completion/Unix/Command/_git2
-rw-r--r--Doc/Zsh/compsys.yo5
4 files changed, 29 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 094d92e65..9d399f014 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-03-16  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 34671 plus tweaks: Completion/Base/Utility/_describe
+	Completion/Unix/Command/_git Doc/Zsh/compsys.yo: Add -1 -2 -J -V
+	-x to _describe, use them to sort 'git --fixup' hash completions
+
 	* 34671: Completion/Unix/Command/_git: git completion: only
 	offer recent commits' tags/heads for --fixup
 
diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe
index 1a9f52f5d..ab7200517 100644
--- a/Completion/Base/Utility/_describe
+++ b/Completion/Base/Utility/_describe
@@ -6,23 +6,28 @@ local _opt _expl _tmpm _tmpd _mlen _noprefix
 local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
 local csl="$compstate[list]" csl2
 local _oargv _argv _new _strs _mats _opts _i _try=0
+local OPTIND OPTARG
+local -a _jvx12
 
 # Get the option.
 
-if [[ "$1" = -o ]]; then
-  _type=options
-  shift
-elif [[ "$1" = -O ]]; then
-  _type=options
-  _noprefix=1
-  shift
-elif [[ "$1" = -t ]]; then
-  _type="$2"
-  shift 2
-elif [[ "$1" = -t* ]]; then
-  _type="${1[3,-1]}"
-  shift
-fi
+while getopts "oOt:12JVx" _opt; do
+  case $_opt in
+    (o)
+      _type=options;;
+    (O)
+      _type=options
+      _noprefix=1
+      ;;
+    (t)
+      _type="$OPTARG"
+      ;;
+    (1|2|J|V|x)
+      _jvx12+=(-$_opt)
+  esac
+done
+shift $(( OPTIND - 1 ))
+unset _opt
 
 [[ "$_type$_noprefix" = options && ! -prefix [-+]* ]] && \
     zstyle -T ":completion:${curcontext}:options" prefix-needed &&
@@ -53,7 +58,7 @@ fi
 
 _tags "$_type"
 while _tags; do
-  while _next_label "$_type" _expl "$_descr"; do
+  while _next_label $_jvx12 "$_type" _expl "$_descr"; do
 
     if (( $#_grp )); then
   
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index aa1124706..e5639fab2 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5669,7 +5669,7 @@ __git_recent_commits () {
   expl=()
   _wanted heads expl 'head' compadd "$@" -a - heads && ret=0
   expl=()
-  _describe -t commits 'commit object name' descr && ret=0
+  _describe -2Vx -t commits 'commit object name' descr && ret=0
 }
 
 (( $+functions[__git_blob_objects] )) ||
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 89cd05121..6c6bedb21 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -4140,7 +4140,7 @@ tt(compadd) when generating matches from the style value, or to
 the functions for the fields if they are called.
 )
 findex(_describe)
-item(tt(_describe) [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
+item(tt(_describe) [tt(-12JVx)] [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
 This function associates completions with descriptions.
 Multiple groups separated by tt(-)tt(-) can be supplied, potentially with
 different completion options var(opts).
@@ -4171,6 +4171,9 @@ tt(prefix-needed) style.
 With the tt(-t) option a var(tag) can be specified.  The default is
 `tt(values)' or, if the tt(-o) option is given, `tt(options)'.
 
+The options tt(-1), tt(-2), tt(-J), tt(-V), tt(-x) are passed to
+tt(_next_label).
+
 If selected by the tt(list-grouped) style, strings with the same
 description will appear together in the list.