Don't read the hash if the file doesn't look like a branch

Follow-up to 0668f25
This commit is contained in:
Kirill Likhodedov
2017-03-03 22:06:03 +00:00
parent 80a4eb3574
commit 5bfa67eddb
@@ -272,9 +272,12 @@ class GitRepositoryReader {
String relativePath = FileUtil.getRelativePath(refsRootDir, file);
if (relativePath != null) {
String branchName = prefix + FileUtil.toSystemIndependentName(relativePath);
String hash = loadHashFromBranchFile(file);
if (hash != null && GitRefNameValidator.getInstance().checkInput(branchName)) {
result.put(branchName, hash);
boolean isBranchNameValid = GitRefNameValidator.getInstance().checkInput(branchName);
if (isBranchNameValid) {
String hash = loadHashFromBranchFile(file);
if (hash != null) {
result.put(branchName, hash);
}
}
}
}