git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] completion: zsh: trivial improvement

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 8, 2021, 02:38 UTC
Message-ID
<20210608023807.907883-1-felipe.contreras@gmail.com>
$words has basically all the words we need, except the first one: git.

Lets simply add that instead of passing the original, which contains options we don't want to pass downstream (like --git-dir).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.zsh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index cac6f61881..50f89145f3 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -219,9 +219,6 @@ __git_zsh_main ()
 {
 	local curcontext="$curcontext" state state_descr line
 	typeset -A opt_args
-	local -a orig_words
-
-	orig_words=( ${words[@]} )
 
 	_arguments -C \
 		'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
@@ -261,7 +258,7 @@ __git_zsh_main ()
 
 		(( $+opt_args[--help] )) && command='help'
 
-		words=( ${orig_words[@]} )
+		words=( git ${words[@]} )
 
 		__git_zsh_bash_func $command
 		;;
-- 
2.32.0.2.g41be0a4e50
Next: SZEDER Gábor
Message 1 of 3 in “completion: zsh: trivial improvement”
  1. completion: zsh: trivial improvementFelipe Contreras, Jun 8, 2021
  2. SZEDER GáborJun 8, 2021
  3. Felipe ContrerasJun 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.