Allow refs/* pattern on new reference rights

The reference name "refs/*" was being rejected because JGit's
Repository.isValidRefName() method was passed "refs" and it
requires there be at least one "/" in the name given.

Use a special case for "refs/*" since we permit this to match
any reference in the repository.

Change-Id: I5e77819e8414ff7681928dcd53c2fdbbe2e0be0f
Signed-off-by: Shawn O. Pearce <sop@google.com>
Reviewed-by: Nico Sallembien <nsallembien@google.com>
This commit is contained in:
Shawn O. Pearce
2010-02-03 07:17:11 -08:00
parent 4757d276dd
commit dd1a0f8b18

View File

@@ -143,7 +143,7 @@ class AddRefRight extends Handler<ProjectDetail> {
}
if (refPattern.endsWith("/*")) {
final String prefix = refPattern.substring(0, refPattern.length() - 2);
if (!Repository.isValidRefName(prefix)) {
if (!"refs".equals(prefix) && !Repository.isValidRefName(prefix)) {
throw new InvalidNameException();
}
} else {