small tip regarding git branch bash prompt in F18/Rawhide

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Sat Aug 25 16:46:46 UTC 2012


Todd Zullinger <tmz at pobox.com> writes:

>>> I placed git-prompt.sh in /etc/profile.d where it should be sourced
>>> for normal login shells.
>>
>> As I wrote in the update comment, please revert it.  It pollutes the
>> environment of every user with functions which are probably never be
>> used.
> ...
> Doing this would break current users that have already configured
> their system to use __git_ps1().

What are "current users"? Those who installed your just released rawhide
changes?

Else, __git_ps1 was never available without sourceing
/etc/bash_completion.d/git.  Nobody stops you to source the __git_ps1()
function from within the bash-completion file (defining a bash function
twice is not a problem).

E.g.:

1. move __git_ps1() into /usr/share/git/functions

2. add 'source /usr/share/git/functions' in /etc/bash_completion.d/git

3. document that people have to add

   | source /usr/share/git/functions

   to ~/.bash_profile when they want __git_ps1() without bash-completion



Enrico


More information about the devel mailing list