fix issue with --repositorypath not honoring --prefix

split off from #1028 

@stdweird: please review