summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-07-31 00:59:33 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-02 14:09:57 +0000
commit17a6eb655d0952c090c36abeec4ba17c11b3b165 (patch)
treefc54dd8b348d4961b0e9d3793b13d81f178f9621
parent27efa0efd43d1b5aa00c620710cf6d7568e3ca9b (diff)
downloadzsh-17a6eb655d0952c090c36abeec4ba17c11b3b165.tar.gz
zsh-17a6eb655d0952c090c36abeec4ba17c11b3b165.tar.xz
zsh-17a6eb655d0952c090c36abeec4ba17c11b3b165.zip
41475: _git: Complete files after 'reset' when there are no commits, when the 'verbose' style is set.
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Unix/Command/_git6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ad2d453bd..d6d6bb382 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-02  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 41475: Completion/Unix/Command/_git: Complete files after
+	'reset' when there are no commits, when the 'verbose' style
+	is set.
+
 2017-08-01  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 41470: Doc/Zsh/builtins.yo: note that 41464 stops exec finding
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index ce8a4049d..032cbad1e 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1462,6 +1462,12 @@ _git-reset () {
   case $state in
     (file)
       local tree=HEAD
+      if zstyle -t :completion:${curcontext}: verbose; then
+        if ! _call_program headed git rev-parse --verify HEAD 2>/dev/null; then
+          # well-known sha1 of the empty tree
+          tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+        fi
+      fi
       if [[ -n $line[1] ]] && __git_is_treeish $line[1]; then
         tree=$line[1]
       fi