Fix handling of branches with slashes, fixes #1748