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

[PATCH v7 11/49] completion: zsh: trivial improvement

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 1, 2023, 08:45 UTC
Message-ID
<20230401084626.304356-12-felipe.contreras@gmail.com>
In-Reply-To
<20230401084626.304356-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 -c and -C).

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 13809f7894..790879e319 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -215,9 +215,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'']' \
@@ -257,7 +254,7 @@ __git_zsh_main ()
 
 		(( $+opt_args[--help] )) && command='help'
 
-		words=( ${orig_words[@]} )
+		words=( git ${words[@]} )
 
 		__git_zsh_bash_func $command
 		;;
-- 
2.33.0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 12 of 50 in “completion: git-completion 2.0 patches”
  1. 00/49 completion: git-completion 2.0 patchesFelipe Contreras, Apr 1, 2023
  2. 02/49 completion: bash: trivial cleanupFelipe Contreras, Apr 1, 2023
  3. 01/49 test: completion add test for __git_cmd_idxFelipe Contreras, Apr 1, 2023
  4. 03/49 zsh: remove versionFelipe Contreras, Apr 1, 2023
  5. 04/49 completion: bash: trivial grammar fixFelipe Contreras, Apr 1, 2023
  6. 05/49 completion: zsh: add higher-priority locationFelipe Contreras, Apr 1, 2023
  7. 06/49 zsh: resolve symlink of scriptFelipe Contreras, Apr 1, 2023
  8. 07/49 zsh: simplify realpath dirname idiomFelipe Contreras, Apr 1, 2023
  9. 08/49 test: completion: use global configFelipe Contreras, Apr 1, 2023
  10. 09/49 completion: fix __git_cmd_idx regression for zshFelipe Contreras, Apr 1, 2023
  11. 10/49 completion: fix for suboptions with valueFelipe Contreras, Apr 1, 2023
  12. 11/49 completion: zsh: trivial improvementFelipe Contreras, Apr 1, 2023
  13. 12/49 completion: bash: do not modify COMP_WORDBREAKSFelipe Contreras, Apr 1, 2023
  14. 13/49 test: completion: fix currently typed wordsFelipe Contreras, Apr 1, 2023
  15. 14/49 test: completion: switch __gitcomp_nl prefix testFelipe Contreras, Apr 1, 2023
  16. 15/49 test: completion: add run_func() helperFelipe Contreras, Apr 1, 2023
  17. 16/49 completion: bash: remove non-append functionalityFelipe Contreras, Apr 1, 2023
  18. 17/49 completion: bash: get rid of _append() functionsFelipe Contreras, Apr 1, 2023
  19. 18/49 completion: bash: get rid of any non-append codeFelipe Contreras, Apr 1, 2023
  20. 19/49 completion: zsh: fix options with argumentsFelipe Contreras, Apr 1, 2023
  21. 20/49 completion: zsh: expand --git-dir file argumentFelipe Contreras, Apr 1, 2023
  22. 21/49 completion: zsh: add support for general -C optsFelipe Contreras, Apr 1, 2023
  23. 22/49 completion: zsh: fix for undefined completionsFelipe Contreras, Apr 1, 2023
  24. 23/49 completion: zsh: add support for general -c optsFelipe Contreras, Apr 1, 2023
  25. 24/49 completion: zsh: fix extra space on foo=Felipe Contreras, Apr 1, 2023
  26. 25/49 completion: zsh: add excluded optionsFelipe Contreras, Apr 1, 2023
  27. 26/49 completion: zsh: always set compsetFelipe Contreras, Apr 1, 2023
  28. 27/49 completion: factor out check in __gitcompFelipe Contreras, Apr 1, 2023
  29. 28/49 completion: simplify equal suffix checkFelipe Contreras, Apr 1, 2023
  30. 29/49 completion: refactor __gitcompFelipe Contreras, Apr 1, 2023
  31. 30/49 completion: simplify __gitcompFelipe Contreras, Apr 1, 2023
  32. 31/49 completion: bash: change suffix check in __gitcompFelipe Contreras, Apr 1, 2023
  33. 32/49 completion: improve __gitcomp suffix codeFelipe Contreras, Apr 1, 2023
  34. 33/49 test: completion: add missing testFelipe Contreras, Apr 1, 2023
  35. 34/49 completion: bash: simplify config_variable_nameFelipe Contreras, Apr 1, 2023
  36. 35/49 completion: bash: improve __gitcomp descriptionFelipe Contreras, Apr 1, 2023
  37. 36/49 completion: add __gitcomp_optsFelipe Contreras, Apr 1, 2023
  38. 37/49 completion: bash: cleanup __gitcomp* invocationsFelipe Contreras, Apr 1, 2023
  39. 38/49 completion: bash: shuffle __gitcomp functionsFelipe Contreras, Apr 1, 2023
  40. 39/49 completion: zsh: simplify __gitcomp_directFelipe Contreras, Apr 1, 2023
  41. 40/49 completion: zsh: shuffle __gitcomp* functionsFelipe Contreras, Apr 1, 2023
  42. 41/49 completion: zsh: fix direct quotingFelipe Contreras, Apr 1, 2023
  43. 42/49 completion: zsh: add elements individually in __gitcomp_optsFelipe Contreras, Apr 1, 2023
  44. 43/49 completion: zsh: add __gitcompadd helperFelipe Contreras, Apr 1, 2023
  45. 44/49 completion: zsh: add correct removable suffixFelipe Contreras, Apr 1, 2023
  46. 45/49 completion: bash: simplify _get_comp_words_by_ref()Felipe Contreras, Apr 1, 2023
  47. 46/49 completion: bash: refactor _get_comp_words_by_ref()Felipe Contreras, Apr 1, 2023
  48. 47/49 completion: bash: cleanup _get_comp_words_by_ref()Felipe Contreras, Apr 1, 2023
  49. 48/49 completion: bash: trivial cleanupFelipe Contreras, Apr 1, 2023
  50. 49/49 completion: bash: rename _get_comp_words_by_ref()Felipe Contreras, Apr 1, 2023

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.