This check can fail if one branch name is a substring of another one.