[git] Better fix for IDEA-97728: let getBranches return null

getBranches returns null when the information is not available => the meaning is different from the empty list.
This reverts incorrect 38caf3af and another way to fix it 24e296ac2.
This commit is contained in:
Kirill Likhodedov
2012-12-24 15:07:41 +04:00
parent 7043a11931
commit 7602c52a0b
2 changed files with 6 additions and 7 deletions
@@ -101,11 +101,10 @@ public class DetailsCache {
}
}
@NotNull
@Nullable
public List<String> getBranches(final VirtualFile root, final AbstractHash hash) {
synchronized (myLock) {
List<String> branches = myBranches.get(new Pair<VirtualFile, AbstractHash>(root, hash));
return branches == null ? Collections.<String>emptyList() : branches;
return myBranches.get(new Pair<VirtualFile, AbstractHash>(root, hash));
}
}
@@ -157,8 +156,7 @@ public class DetailsCache {
@Override
public void run(@NotNull ProgressIndicator indicator) {
if (!recheck.process(abstractHash)) return;
List<String> branches1 = getBranches(root, abstractHash);
if (branches1 != null && ! branches1.isEmpty()) return;
if (getBranches(root, abstractHash) != null) return;
List<String> branches;
try {
branches = new LowLevelAccessImpl(myProject, root).getBranchesWithCommit(abstractHash.getString());
@@ -495,7 +495,7 @@ public class GitLogUI implements Disposable {
if (commitI == null) return;
final VirtualFile root = commitI.selectRepository(myRootsUnderVcs);
final List<String> branches = myDetailsCache.getBranches(root, commitI.getHash());
if (branches != null && ! branches.isEmpty()) {
if (branches != null) {
try {
myBranchesLoader.take(commitI, branches);
}
@@ -1050,7 +1050,8 @@ public class GitLogUI implements Disposable {
@NotNull
@Override
public List<String> getContainingBranches(@NotNull VirtualFile root, @NotNull AbstractHash commitHash) {
return myDetailsCache.getBranches(root, commitHash);
List<String> branches = myDetailsCache.getBranches(root, commitHash);
return branches == null ? Collections.<String>emptyList() : branches;
}
};
}