From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] _git: Complete files after 'reset' when there are no commits, when the 'verbose' style is set.
Date: Mon, 31 Jul 2017 00:59:33 +0000 [thread overview]
Message-ID: <20170731005933.18904-1-danielsh@tarpaulin.shahaf.local2> (raw)
---
Completion/Unix/Command/_git | 6 ++++++
1 file changed, 6 insertions(+)
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
That magic value has been used by vcs_info for a while.
I opted for making this conditional upon 'verbose' since this is a bit of an
edge case, and forks aren't free everywhere.
Cheers,
Daniel
next reply other threads:[~2017-07-31 0:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 0:59 Daniel Shahaf [this message]
2017-08-05 22:11 ` Oliver Kiddle
2017-08-06 17:01 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170731005933.18904-1-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).