Make Branch.NameKey enforce full ref names

Also remove some now redundant ref fixes before constructing
Branch.NameKeys.  This reduces the proliferation of "correcting" code.

Change-Id: I5d9864d7c6ea7252f05a4ccabcf124cb014c4fae
This commit is contained in:
Martin Fick
2015-04-13 10:41:14 -06:00
committed by David Pursehouse
parent c16ab0df0d
commit 4ddbfc9a8b
6 changed files with 14 additions and 20 deletions

View File

@@ -57,8 +57,7 @@ public class ChangeIdHandler extends OptionHandler<Change.Id> {
try {
final Change.Key key = Change.Key.parse(tokens[2]);
final Project.NameKey project = new Project.NameKey(tokens[0]);
final Branch.NameKey branch =
new Branch.NameKey(project, "refs/heads/" + tokens[1]);
final Branch.NameKey branch = new Branch.NameKey(project, tokens[1]);
for (final ChangeData cd : queryProvider.get().byBranchKey(branch, key)) {
setter.addValue(cd.getId());
return 1;