From 0a35e5f25bb6b865b90678f0589f97407f461f9c Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 29 Apr 2018 17:15:18 -0700 Subject: Rename RefDatabase#getAllRefs to getRefs This is easier to type and makes it clearer that it only returns refs and not the pseudo-refs returned by getAdditionalRefs. It also puts us in a better position to add a method to the Repository class later that delegates to this one without colliding with the existing Repository#getAllRefs method that returns a Map. While at it, clarify the javadoc of getRefs and hasRefs to make the same point. Suggested-by: David Pursehouse Change-Id: I23497c66ac7b5e0c987b91efbc9e9cc29924ca66 Signed-off-by: Jonathan Nieder --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java | 3 +-- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java | 3 +-- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java | 2 +- .../src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java | 2 +- .../src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) (limited to 'org.eclipse.jgit.pgm/src') diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java index a52954307e..21e37cd8c9 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java @@ -71,8 +71,7 @@ class RevParse extends TextBuiltin { @Override protected void run() throws Exception { if (all) { - List allRefs = db.getRefDatabase().getAllRefs(); - for (final Ref r : allRefs) { + for (Ref r : db.getRefDatabase().getRefs()) { ObjectId objectId = r.getObjectId(); // getRefs skips dangling symrefs, so objectId should never be // null. diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 423887cc17..80161b4829 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -169,8 +169,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { walk.setRevFilter(AndRevFilter.create(revLimiter)); if (all) { - List refs = db.getRefDatabase().getAllRefs(); - for (Ref a : refs) { + for (Ref a : db.getRefDatabase().getRefs()) { ObjectId oid = a.getPeeledObjectId(); if (oid == null) oid = a.getObjectId(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java index f6384a2cea..9ce8347d91 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ShowRef.java @@ -65,7 +65,7 @@ class ShowRef extends TextBuiltin { } private Iterable getSortedRefs() throws Exception { - List all = db.getRefDatabase().getAllRefs(); + List all = db.getRefDatabase().getRefs(); // TODO(jrn) check if we can reintroduce fast-path by e.g. implementing // SortedList return RefComparator.sort(all); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index 19d94eadef..42dea219f7 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -245,7 +245,7 @@ class RebuildCommitGraph extends TextBuiltin { private void deleteAllRefs() throws Exception { final RevWalk rw = new RevWalk(db); - for (Ref r : db.getRefDatabase().getAllRefs()) { + for (Ref r : db.getRefDatabase().getRefs()) { if (Constants.HEAD.equals(r.getName())) continue; final RefUpdate u = db.updateRef(r.getName()); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java index 6665ce7c1d..86092b27a5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildRefTree.java @@ -154,7 +154,7 @@ class RebuildRefTree extends TextBuiltin { head)); } - for (Ref r : refdb.getAllRefs()) { + for (Ref r : refdb.getRefs()) { if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD) || r.getName().startsWith(txnNamespace)) { continue; -- cgit v1.2.3