From 5bfa67eddb5a0c692e90e24fce0d45cbc8839cf7 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Fri, 3 Mar 2017 22:03:06 +0000 Subject: [PATCH] Don't read the hash if the file doesn't look like a branch Follow-up to 0668f25 --- .../git4idea/src/git4idea/repo/GitRepositoryReader.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java b/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java index 06a32c52e434..242b6d7805a5 100644 --- a/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java +++ b/plugins/git4idea/src/git4idea/repo/GitRepositoryReader.java @@ -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); + } } } }