Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug in git tab completion: If git.showSignature = true is set globally, tab completion of commits is garbled



On 7 Mar 2019, at 13:23, Adrian Vollmer <zsh@xxxxxxxxxxxxxxx> wrote:
>to reproduce this bug, set showSignature = true in the log section of
>your global git config file, then type git reset <TAB> in a git repo
>that has a recent signed commit in its history.

I guess this is the simple fix for this particular case. `git log` is called
in a few other places, too, but i'm not sure if they're problematic. Probably
are and i just don't know how to trigger it.

Maybe it would make sense to do something more robust instead, though? For
example, we could have a __git_call wrapper around _call_program that always
calls git with a safe set of -c options, &c. It'd be a lot of lines changed,
but any further issues like this could be fixed in one place. idk.

dana


diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index e5e4ee768..796a98fd5 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6517,7 +6517,7 @@ __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 -c log.showSignature=false --no-pager log ${(q)commit_opts} -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}")
   __git_command_successful $pipestatus || return 1
 
   for i j k parents in "$commits[@]" ; do



Messages sorted by: Reverse Date, Date, Thread, Author