about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorDaniel Hahler <genml+zsh-workers@thequod.de>2015-03-06 20:33:14 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-03-07 03:56:48 +0000
commitce80a925d69ed446d0cae8fb9c46f1f5398b8b93 (patch)
tree584f5c5dd02a082cf58d80d174abb260645463aa /Completion
parentd902b55bd404902ea42f4ac780d47960e088d9fd (diff)
downloadzsh-ce80a925d69ed446d0cae8fb9c46f1f5398b8b93.tar.gz
zsh-ce80a925d69ed446d0cae8fb9c46f1f5398b8b93.tar.xz
zsh-ce80a925d69ed446d0cae8fb9c46f1f5398b8b93.zip
34638 with tweaks: git completion: complete commit hashes and --fixup
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_git12
1 files changed, 9 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 9552780c6..58d642216 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -647,8 +647,8 @@ _git-commit () {
   # TODO: --interactive isn't explicitly listed in the documentation.
   _arguments -w -S -s \
     '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \
-    '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:' \
-    '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:' \
+    '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_commits' \
+    '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_commits' \
     $reset_author_opt \
     '(        --porcelain --dry-run)--short[output dry run in short format]' \
     '(--short             --dry-run)--porcelain[output dry run in porcelain-ready format]' \
@@ -5631,7 +5631,13 @@ __git_heads () {
 
 (( $+functions[__git_commit_objects] )) ||
 __git_commit_objects () {
-  _guard '[[:xdigit:]](#c,40)' 'commit object name'
+  local gitdir expl start
+  declare -a commits
+
+  : ${(A)commits::=${(f)"$(_call_program commits git --no-pager log -20 --format='%h:%s')"}}
+  __git_command_successful $pipestatus || return 1
+
+  _describe -t commits 'commit object name' commits
 }
 
 (( $+functions[__git_blob_objects] )) ||