[arch-general] Funny issue with bash-completion and __git_ps1

Thomas Bächler thomas at archlinux.org
Wed Mar 28 05:38:51 EDT 2012


Am 28.03.2012 08:05, schrieb martin kalcher:
> Hey hey
> 
> After the last bash-completion and git update there is a funny issue
> with the Git Prompt [1]: __git_ps1 is not defined
> 
> The bash-completion update moved most completion scripts to
> /usr/share/bash-completion/completions/
> 
> and sources them if needed. See line 1933 in:
> /usr/share/bash-completion/bash_completion
> 
> __git_ps1 is defined in:
> /usr/share/bash-completion/completions/git
> 
> So if you type 'git pul<TAB>' this file gets sourced and the error
> disappears. I worked around this by sourcing this file manually in my
> .bashrc
> 
> My question is, where i should report this bug. Is it a git problem or a
> bash-completion problem. I think its a git issue, because __git_ps1 is
> no complete function and should be defined somewhere else... Or shall i
> shut my mouth and continue sourcing it in my .bashrc?

I just noticed this. The bash completion now uses a dynamic loading
mechanism for the new path (the old compat path is still sourced
unconditionally as it seems).

A workaround is writing this in your .bashrc:
 _xfunc git __git_ps1 &>/dev/null
Then everything works. Clearly, git abuses the completion file to define
functions that are unrelated to completion.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20120328/7460d455/attachment.asc>


More information about the arch-general mailing list