fix issue with --repositorypath not honoring --prefix

split off from #1028 

@stdweird: please review
shouldn't `repositorypath` be processed before `repository` ? (and if so, make separate comment about it)