aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2021-06-23 10:29:21 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2021-11-25 12:06:29 +0100
commit0a3aaac33ef77ec4664b35b4f4e1d590e8208182 (patch)
tree07dab5d6e10167d7cc418321f5500d888d22796f
parent403338e11640b61837165d90965de44da0e26379 (diff)
downloadjgit-0a3aaac33ef77ec4664b35b4f4e1d590e8208182.tar.gz
jgit-0a3aaac33ef77ec4664b35b4f4e1d590e8208182.zip
Don't use deprecated Repository#getAllRefs in Repository
Also expose the potentially IOException thrown by RefDatabase#getRefs. Hence the following methods now potentially throw IOException: - Repository#getAllRefsByPeeledObjectId Bug: 534731 Change-Id: Id6956ff112560e6314d4335238494708346f2338
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java2
2 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index 2d1aca8de1..e594e528be 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -1161,12 +1161,14 @@ public abstract class Repository implements AutoCloseable {
* Get a map with all objects referenced by a peeled ref.
*
* @return a map with all objects referenced by a peeled ref.
+ * @throws IOException
*/
@NonNull
- public Map<AnyObjectId, Set<Ref>> getAllRefsByPeeledObjectId() {
- Map<String, Ref> allRefs = getAllRefs();
+ public Map<AnyObjectId, Set<Ref>> getAllRefsByPeeledObjectId()
+ throws IOException {
+ List<Ref> allRefs = getRefDatabase().getRefs();
Map<AnyObjectId, Set<Ref>> ret = new HashMap<>(allRefs.size());
- for (Ref ref : allRefs.values()) {
+ for (Ref ref : allRefs) {
ref = peel(ref);
AnyObjectId target = ref.getPeeledObjectId();
if (target == null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
index b4ccfe0ae4..0582338652 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
@@ -121,7 +121,7 @@ public class PlotWalk extends RevWalk {
return pc;
}
- private Ref[] getRefs(AnyObjectId commitId) {
+ private Ref[] getRefs(AnyObjectId commitId) throws IOException {
if (reverseRefMap == null) {
reverseRefMap = repository.getAllRefsByPeeledObjectId();
for (Map.Entry<AnyObjectId, Set<Ref>> entry : additionalRefMap