put git_prompt_dir in a function and apply gitprompt only to git repositories

I guess I messed up the merge tree quite a bit :-( (not a straight line at all). The commit d22e1b4 is redone in later commits and really not needed. 
For normal non-git directories, the normal bash prompt is retained.