From 7602c52a0b1d094b1328e5d04d7ec12733ddb102 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 24 Dec 2012 15:06:30 +0400 Subject: [PATCH] [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. --- .../src/git4idea/history/wholeTree/DetailsCache.java | 8 +++----- .../git4idea/src/git4idea/history/wholeTree/GitLogUI.java | 5 +++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java b/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java index af47ebbbfcdb..b78613ea66ef 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java @@ -101,11 +101,10 @@ public class DetailsCache { } } - @NotNull + @Nullable public List getBranches(final VirtualFile root, final AbstractHash hash) { synchronized (myLock) { - List branches = myBranches.get(new Pair(root, hash)); - return branches == null ? Collections.emptyList() : branches; + return myBranches.get(new Pair(root, hash)); } } @@ -157,8 +156,7 @@ public class DetailsCache { @Override public void run(@NotNull ProgressIndicator indicator) { if (!recheck.process(abstractHash)) return; - List branches1 = getBranches(root, abstractHash); - if (branches1 != null && ! branches1.isEmpty()) return; + if (getBranches(root, abstractHash) != null) return; List branches; try { branches = new LowLevelAccessImpl(myProject, root).getBranchesWithCommit(abstractHash.getString()); diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java index bd2e523d44fd..5f2dc82d4777 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/GitLogUI.java @@ -495,7 +495,7 @@ public class GitLogUI implements Disposable { if (commitI == null) return; final VirtualFile root = commitI.selectRepository(myRootsUnderVcs); final List 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 getContainingBranches(@NotNull VirtualFile root, @NotNull AbstractHash commitHash) { - return myDetailsCache.getBranches(root, commitHash); + List branches = myDetailsCache.getBranches(root, commitHash); + return branches == null ? Collections.emptyList() : branches; } }; }