Improved repository check in Repo#initialize

I reworked the repository checks in `Repo#initialize` to be more accurate in detecting (bare) Git repositories. This is a bit smarter than the old approach which is based on path names only. Additionally it checks the Git repository structure for `HEAD`, `objects` and `refs` which is the minimal repo layout.