Fix branchName regex and a related bug.
Merge pull request #2307 from dart-lang/branch_bug

Fix branchName regex and a related bug.