Prefixes that differ only in the trailing slash should be considered identical. Also update the test to check that this works.
We were trying to 'git checkout $prefix', which is ambiguous if $prefix names a directory *and* a branch. Do 'git checkout -- $prefix' instead. The main place this appeared was in 'git subtree add'. Reported by several people.