From: dana <dana@dana.is>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: zsh-workers@zsh.org, Adrian Vollmer <zsh@vollmer.syss.de>
Subject: Re: Bug in git tab completion: If git.showSignature = true is set globally, tab completion of commits is garbled
Date: Sat, 9 Mar 2019 17:37:47 -0600 [thread overview]
Message-ID: <CD16F753-D0B8-44D6-B6FB-AEA50FA32307@dana.is> (raw)
In-Reply-To: <57caa504-8287-4078-bd34-47ac7426e1db@www.fastmail.com>
On 9 Mar 2019, at 10:43, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>Huh. Odd, but I think we can live with that: we can just have _git
>discard the hardcoded header line that git emits. All we really care
>about is that future git versions will continue to emit that line. I
>assume they will, for compatibility reasons.
In that case, i think it would be something like this? I didn't test very
extensively (not even sure which paths exactly lead to these commands), but it
does seem to work for the scenario at hand
(--oneline is hard-coded to not print the hard-coded header)
dana
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index e5e4ee768..4eb07e921 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5652,7 +5652,7 @@ __git_describe_branch () {
local __c
local -a __commits
for __c in ${(P)__commits_in}; do
- __commits+=("${__c}:${$(_call_program describe git log -1 --oneline $__c)//:/\\:}")
+ __commits+=("${__c}:${$(_call_program describe git rev-list -1 --oneline $__c)//:/\\:}")
done
_describe -t $__tag $__desc __commits "$@"
else
@@ -6493,8 +6493,9 @@ __git_commit_objects () {
# Note: the after-the-colon part must be unique across the entire array;
# see workers/34768
- commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"})
+ commits=(${(f)"$(_call_program commits git --no-pager rev-list -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)' HEAD)"})
__git_command_successful $pipestatus || return 1
+ commits=(${commits:#commit [[:xdigit:]](#c40,)})
_describe -Vx -t commits 'commit object name' commits
}
@@ -6503,7 +6504,7 @@ __git_commit_objects () {
__git_recent_commits () {
local gitdir expl start
declare -a descr tags heads commits argument_array_names commit_opts
- local i j k ret
+ local h i j k ret
integer distance_from_head
local label
local parents
@@ -6517,10 +6518,11 @@ __git_recent_commits () {
# Careful: most %d will expand to the empty string. Quote properly!
# NOTE: we could use %D directly, but it's not available in git 1.9.1 at least.
- commits=("${(f)"$(_call_program commits git --no-pager log ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}")
+ commits=("${(f)"$(_call_program commits git --no-pager rev-list ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p' HEAD)"}")
__git_command_successful $pipestatus || return 1
- for i j k parents in "$commits[@]" ; do
+ # h => hard-coded 'commit abcdef1234567890...' -- just discarded
+ for h i j k parents in "$commits[@]" ; do
# Note: the after-the-colon part must be unique across the entire array;
# see workers/34768
if (( $#commit_opts )); then
next prev parent reply other threads:[~2019-03-09 23:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 19:23 Adrian Vollmer
2019-03-07 23:27 ` dana
2019-03-08 20:22 ` Daniel Shahaf
2019-03-09 16:25 ` dana
2019-03-09 16:43 ` Daniel Shahaf
2019-03-09 23:37 ` dana [this message]
2019-03-10 16:20 ` 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=CD16F753-D0B8-44D6-B6FB-AEA50FA32307@dana.is \
--to=dana@dana.is \
--cc=d.s@daniel.shahaf.name \
--cc=zsh-workers@zsh.org \
--cc=zsh@vollmer.syss.de \
/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).