Refactor and better test Repository.path

Refactor method `Repository.path` by trimming down the amount of underlying
code. Better test the method: only one of the two paths was being tested.
Merge pull request #1307 from Ichimonji10/repository-path

Refactor and better test Repository.path