about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2015-05-13 15:26:04 +0200
committerDaniel Hahler <git@thequod.de>2015-05-18 02:48:03 +0200
commit94c6b32fe76f630f6682edb7cb8b9c0c884809a4 (patch)
tree3e57c84e4132306c3352eb3759ee071742765dcd
parent454f079852deb0c704870c7d5a462485f1e65bbf (diff)
downloadzsh-94c6b32fe76f630f6682edb7cb8b9c0c884809a4.tar.gz
zsh-94c6b32fe76f630f6682edb7cb8b9c0c884809a4.tar.xz
zsh-94c6b32fe76f630f6682edb7cb8b9c0c884809a4.zip
35104: completion: git: __git_commit_objects: query 1000 commits
Also, `--all` and `--reflog` is used to get all commits.

It adds the _guard in front, so only non-empty values will come here.
Also, __git_commit_objects_prefer_recent will only call it, if there are
no matching recent commits.
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_git7
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 685575c05..c9f6c8412 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,9 @@
 	then, and is meant to only call __git_recent_commits, if there are
 	matches.
 
+	* 35104: Completion/Unix/Command/_git: __git_commit_objects: query
+	1000 commits.  Also, `--all` and `--reflog` is used to get all commits.
+
 2015-05-16  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 35161: Completion/Unix/Command/_git: completion: git: Fix
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index d64e777e8..f87861edb 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5656,12 +5656,15 @@ __git_commit_objects () {
   local gitdir expl start
   declare -a commits
 
+  # Abort if the argument does not match a commit hash (including empty).
+  _guard '[[:xdigit:]](#c,40)' || return 1
+
   # Note: the after-the-colon part must be unique across the entire array;
   # see workers/34768
-  : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:\\\[%h\\\]\ %s')"}}
+  : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\\\[%h\\\]\ %s')"}}
   __git_command_successful $pipestatus || return 1
 
-  _describe -V -t commits 'commit object name' commits || _guard '[[:xdigit:]](#c,40)' 'commit object name'
+  _describe -V -t commits 'commit object name' commits
 }
 
 (( $+functions[__git_recent_commits] )) ||