about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-08-19 23:27:33 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-08-19 23:27:40 +0000
commitea5d100643646af718309d54975424f08963fe6f (patch)
tree8de2849e7af4f07c58952a8ae9b9a42097684a7e
parent8ed6bc0a85a3483823919aee7067eea1199466df (diff)
downloadzsh-ea5d100643646af718309d54975424f08963fe6f.tar.gz
zsh-ea5d100643646af718309d54975424f08963fe6f.tar.xz
zsh-ea5d100643646af718309d54975424f08963fe6f.zip
36148: _git-log: Complete flags after positional argument
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git48
2 files changed, 28 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f95ca5c8..21cd189fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-19  Oliver Kiddle  <opk@zsh.org>
+
+	* 36148: Completion/Unix/Command/_git: _git-log: Complete flags
+	after positional argument
+
 2015-08-19  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 36241: Test/V09datetime.ztst: Test for 36227.
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 92db67928..3c20ca663 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1087,33 +1087,31 @@ _git-log () {
     $revision_options \
     '-L+[trace the evolution of a line range or regex within a file]:range' \
     '(-)--[start file arguments]' \
-    '*:: :->commit-range-or-file' && ret=0
+    '1: :->first-commit-ranges-or-files' \
+    '*: :->commit-ranges-or-files' && ret=0
 
   case $state in
-    (commit-range-or-file)
-      case $CURRENT in
-        (1)
-          if [[ -n ${opt_args[(I)--]} ]]; then
-            __git_cached_files && ret=0
-          else
-            _alternative \
-              'commit-ranges::__git_commit_ranges' \
-              'cached-files::__git_cached_files' && ret=0
-          fi
-          ;;
-        (*)
-          # TODO: Write a wrapper function that checks whether we have a
-          # committish range or comittish and calls __git_tree_files
-          # appropriately.
-          if __git_is_committish_range $line[1]; then
-            __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
-          elif __git_is_committish $line[1]; then
-            __git_tree_files ${PREFIX:-.} $line[1] && ret=0
-          else
-            __git_cached_files && ret=0
-          fi
-          ;;
-      esac
+    (first-commit-ranges-or-files)
+      if [[ -n ${opt_args[(I)--]} ]]; then
+	__git_cached_files && ret=0
+      else
+	_alternative \
+	  'commit-ranges::__git_commit_ranges' \
+	  'cached-files::__git_cached_files' && ret=0
+      fi
+    ;;
+    (commit-ranges-or-files)
+      # TODO: Write a wrapper function that checks whether we have a
+      # committish range or comittish and calls __git_tree_files
+      # appropriately.
+      if __git_is_committish_range $line[1]; then
+	__git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0
+      elif __git_is_committish $line[1]; then
+	__git_tree_files ${PREFIX:-.} $line[1] && ret=0
+      else
+	__git_cached_files && ret=0
+      fi
+    ;;
   esac
 
   return ret