Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Use that git-show completion in more places.



This makes some completions that would just verify you typed a hex
number complete that rev:file i added for git-show earlier. Ideally
the _git_trees should only complete rev:dir, not rev:dir/file, but I
guess just don't type files for now :). I guess in some cases it
should complete directly to rev: instead of making you type the colon,
since those commands don't take commit-ishes, but I'm not sure how to
do that (or if it's worth the trouble).

http://git.mikachu.ath.cx/?p=zsh-cvs.git;a=commitdiff_plain;h=revfile

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 95acdaf..5f71848 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1016,20 +1016,7 @@ _git-show () {

   _arguments -S \
     $revision_arguments \
-    '*:object:->object' && ret=0
-
-  case $state in
-    (object)
-      compset -P '*:'
-      if [[ -n $IPREFIX ]]; then
-        __git_tree_files ${IPREFIX%:}
-      else
-        _alternative \
-          'revisions:revision:__git_revisions' \
-          'files:file:__git_files'
-      fi
-      ;;
-  esac
+    '*:object:__git_objects' && ret=0
 }

 (( $+functions[_git-show-index] )) ||
@@ -2273,7 +2260,7 @@ _git-rev-parse () {
     '--short=-[show only handful hexdigits prefix]:: :_guard
"[[\:digit\:]]#" number' \
     {--after=-,--since=-}'[show "--max-age=" parameter corresponding
given date string]:datestring' \
     {--berore=-,--until=-}'[show "--min-age=" parameter corresponding
given date string]:datestring' \
-    '*:args' && ret=0
+    '*:objects:__git_objects' && ret=0
 }

 (( $+functions[_git-runstatus] )) ||
@@ -2570,12 +2557,19 @@ __git_command_successful () {

 (( $+functions[__git_objects] )) ||
 __git_objects () {
-  __git_guard $* "[[:xdigit:]]#" "object"
+  compset -P '*:'
+  if [[ -n $IPREFIX ]]; then
+    __git_tree_files ${IPREFIX%:}
+  else
+    _alternative \
+      'revisions:revision:__git_revisions' \
+      'files:file:__git_files'
+  fi
 }

 (( $+functions[__git_trees] )) ||
 __git_trees () {
-  __git_guard $* "[[:xdigit:]]#" "tree"
+  __git_objects
 }

 (( $+functions[__git_tree_ishs] )) ||
@@ -2585,7 +2579,7 @@ __git_tree_ishs () {

 (( $+functions[__git_blobs] )) ||
 __git_blobs () {
-  __git_guard $* "[[:xdigit:]]#" 'blob id'
+  __git_objects
 }

 (( $+functions[__git_stages] )) ||

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author