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

[PATCH v3 06/29] completion: zsh: update slave script locations

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Oct 28, 2020, 02:06 UTC
Message-ID
<20201028020712.442623-7-felipe.contreras@gmail.com>
In-Reply-To
<20201028020712.442623-1-felipe.contreras@gmail.com>

Update the default locations of typical system bash-completion, including the default bash-completion location for user scripts, and the recommended way to find the system location (with pkg-config).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.zsh | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 5d6740c6ff..ccf384ba35 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -13,7 +13,7 @@
 #  fpath=(~/.zsh $fpath)
 #
 # You need git's bash completion script installed. By default bash-completion's
-# location will be used (e.g. /usr/share/bash-completion/completions/git).
+# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
 #
 # If your bash completion script is somewhere else, you can specify the
 # location in your ~/.zshrc:
@@ -33,12 +33,16 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
 zstyle -s ":completion:*:*:git:*" script script
 if [ -z "$script" ]; then
 	local -a locations
-	local e
+	local e bash_completion
+
+	bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
+		bash_completion='/usr/share/bash-completion/completions/'
+
 	locations=(
 		"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
-		'/etc/bash_completion.d/git' # fedora, old debian
-		'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
-		'/usr/share/bash-completion/git' # gentoo
+		"$HOME/.local/share/bash-completion/completions/git"
+		"$bash_completion/git"
+		'/etc/bash_completion.d/git' # old debian
 		)
 	for e in $locations; do
 		test -f $e && script="$e" && break
-- 
2.29.1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 25 of 31 in “completion: zsh: latest patches”
  1. 00/29 completion: zsh: latest patchesFelipe Contreras, Oct 28, 2020
  2. 13/29 completion: zsh: add missing direct_appendFelipe Contreras, Oct 28, 2020
  3. 10/29 completion: bash: remove zsh wrapperFelipe Contreras, Oct 28, 2020
  4. 23/29 completion: zsh: add alias descriptionsFelipe Contreras, Oct 28, 2020
  5. 25/29 completion: zsh: add simple version checkFelipe Contreras, Oct 28, 2020
  6. 09/29 completion: bash: synchronize zsh wrapperFelipe Contreras, Oct 28, 2020
  7. 14/29 completion: zsh: fix splitting of wordsFelipe Contreras, Oct 28, 2020
  8. 29/29 Update copyright noticesFelipe Contreras, Oct 28, 2020
  9. 02/29 completion: zsh: fix name due to broken autoloadingFelipe Contreras, Oct 28, 2020
  10. 11/29 completion: zsh: fix completion for --no-.. optionsFelipe Contreras, Oct 28, 2020
  11. 12/29 completion: fix conflict with bashcompFelipe Contreras, Oct 28, 2020
  12. 17/29 completion: zsh: trivial cleanupFelipe Contreras, Oct 28, 2020
  13. 16/29 completion: zsh: simplify direct compaddFelipe Contreras, Oct 28, 2020
  14. 07/29 completion: prompt: fix color for ZshFelipe Contreras, Oct 28, 2020
  15. 28/29 completion: bash: remove old compat wrappersFelipe Contreras, Oct 28, 2020
  16. 01/29 completion: zsh: fix __gitcomp_direct()Felipe Contreras, Oct 28, 2020
  17. 20/29 completion: zsh: shuffle functions aroundFelipe Contreras, Oct 28, 2020
  18. 21/29 completion: zsh: refactor command completionFelipe Contreras, Oct 28, 2020
  19. 08/29 completion: zsh: fix for command aliasingFelipe Contreras, Oct 28, 2020
  20. 03/29 completion: zsh: fix bash script extensionFelipe Contreras, Oct 28, 2020
  21. 24/29 completion: zsh: trivial simplificationFelipe Contreras, Oct 28, 2020
  22. 18/29 completion: zsh: simplify nl_appendFelipe Contreras, Oct 28, 2020
  23. 27/29 completion: bash: cleanup cygwin checkFelipe Contreras, Oct 28, 2020
  24. 26/29 completion: bash: trivial cleanupFelipe Contreras, Oct 28, 2020
  25. 06/29 completion: zsh: update slave script locationsFelipe Contreras, Oct 28, 2020
  26. 05/29 completion: zsh: fix for directories with spacesFelipe Contreras, Oct 28, 2020
  27. 04/29 completion: zsh: reorganize install instructionsFelipe Contreras, Oct 28, 2020
  28. 15/29 completion: zsh: simplify compadd functionsFelipe Contreras, Oct 28, 2020
  29. 22/29 completion: zsh: improve command tagsFelipe Contreras, Oct 28, 2020
  30. 19/29 completion: zsh: simplify file_directFelipe Contreras, Oct 28, 2020
  31. Junio C HamanoOct 29, 2020

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.