On 08/23/2012 12:12 AM, Adam Williamson wrote:
> Hey folks - just in case you haven't all figured this out yet, if you're 
> using the neat little trick of putting a few lines in your ~/.bashrc so that 
> when you're in a directory containing a git repo, the prompt will display 
> what branch you're in, it'll stop working when you update to the latest git - 
> 1.7.12 - in F18 or Rawhide. To fix it, you need to change:
> 
> source /etc/bash_completion.d/git
> 
> to:
> 
> source /usr/share/doc/git-1.7.12/contrib/completion/git-prompt.sh
> 
> because upstream split the prompt stuff out from the bash_completion script. 
> Perhaps the git packagers could consider providing git-prompt.sh in a more 
> permanent location, so we don't have to poke .bashrc every time the git 
> version changes? Thanks!

Nice one.
I've adjusted my .bashrc as follows,
which should work for all versions:

# show extra info in the prompt in git repos
git_prompt_dir=/usr/share/doc/git-*/contrib/completion
git_integration=$git_prompt_dir/git-prompt.sh
test -e $git_integration || git_integration=$git_prompt_dir/git-completion.bash
if test -e $git_integration; then
  source $git_integration
  export GIT_PS1_SHOWDIRTYSTATE=1
  PS1='\[\e[1m\]\h:\W$(__git_ps1 " (%s)")\$\[\e[0m\] '
fi

cheers,
Pádraig.
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel

Reply via email to