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

Re: bash-completion now loads completions dynamically, so __git_ps1 is not defined when you open a shell

From
Jeff King <peff@peff.net>
Date
Mar 29, 2012, 05:49 UTC
Message-ID
<20120329054942.GB27604@sigill.intra.peff.net>
In-Reply-To
<CANaWP3w9KDu57aHquRRYt8td_haSWTBKs7zUHy-xu0B61gmr9A@mail.gmail.com>
On Wed, Mar 28, 2012 at 07:00:35PM -0500, Kerrick Staley wrote:
Show 10 quoted lines
> bash-completion 1.99 (still a "beta", but Arch Linux now ships it)
> will automatically source the git-completion.bash script when you type
> git <tab>. The script is no longer sourced when you first open a
> shell.
> 
> There are two main ways to fix this:
> 1) define __git_ps1 (and friends) in a different script, which will
> get installed in /etc/profile.d (this is the "proper way")
> 2) require that git-completion.bash always be loaded in the beginning
> instead of on-the-fly (which is how it works now now)

I would much rather see (1). There is a very good reason for bash-completion doing dynamic loading, which is that loading all of the completions made shell startup horribly slow. We should do our part to help keep startup fast by splitting the dynamically-loadable bits from the must-be-loaded-at-start bits.

-Peff
Previous: Kerrick StaleyNext: Felipe Contreras
Message 6 of 8 in “bash-completion now loads completions dynamically, so __git_ps1 is not defined when you open a shell”
  1. Kerrick StaleyMar 28, 2012
  2. Junio C HamanoMar 28, 2012
  3. Jeff KingMar 29, 2012
  4. Jonathan NiederMar 28, 2012
  5. Kerrick StaleyMar 29, 2012
  6. Jeff KingMar 29, 2012
  7. Felipe ContrerasApr 7, 2012
  8. Jonathan NiederApr 7, 2012

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.