Find a correct repository name, even if path ends with a slash