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

Re: [PATCH] meson: install shell completion scripts

From
AHAkshay Hegde <lists+git@akshay.is>
Date
Apr 8, 2025, 00:00 UTC
Message-ID
<Z_RnJEyvtGh_0kFo@akshay.is>
In-Reply-To
<20250407-b4-pks-meson-install-completions-v1-1-8a7eb8b9284b@pks.im>
Hi Patrick,
On 2025-04-07 09:42 +0200, Patrick Steinhardt wrote:
Show 7 quoted lines
> Hi,
>
> this patch is a result from the discussion at [1]. Thanks!
>
> Patrick
>
> [1]: <Z-uLqQd7QHZq-tB7@akshay.is>

Awesome, thanks for the patch! I applied it on top of git 2.49.0 and can confirm completion scripts get auto-installed at their appropriate locations under datadir. The datadir can also be customized by passing in '-Ddatadir' to `meson setup` so it's pretty flexible.

One thing of note is that the git completion script for zsh also depends on the bash completion script.

So if you use a non-standard install location like I do (I'm pretty weird, I use macOS with a package manager I've written myself), you'll get an error with the git completion not being able to find the bash script. The fix is to tell zsh where the bash completion script is located. This is also helpfully communicated in the completion script for zsh:

    # You need git's bash completion script installed. By default bash-completion's
    # 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:
    #
    #  zstyle ':completion:*:*:git:*' script ~/.git-completion.bash

Adding the zstyle line to my ~/.zshrc made the completion script work without issues.

Most people won't run into this since if you have this installed in the standard locations, it should just work, and the zsh script does have logic to look for additional paths it may be under. I just wanted to mention it for info.

Cheers,
-- 
	Akshay
Previous: Patrick SteinhardtNext: Todd Zullinger
Message 2 of 8 in “meson: install shell completion scripts”
  1. meson: install shell completion scriptsPatrick Steinhardt, Apr 7, 2025
  2. Akshay HegdeApr 8, 2025
  3. Todd ZullingerApr 8, 2025
  4. Junio C HamanoApr 9, 2025
  5. Eli SchwartzApr 17, 2025
  6. Junio C HamanoApr 17, 2025
  7. Patrick SteinhardtApr 22, 2025
  8. contrib/completion: install Bash completionPatrick Steinhardt, Apr 22, 2025

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.