Fix repo name if repo path is a ".git" directory

/path/to/some/repo/.git should have the name "repo"

Fixes #86. Thanks to @Dafvid for the initial patch.