diff options
author | Jonathan Nieder <jrn@google.com> | 2018-04-29 17:15:18 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2018-04-29 17:19:43 -0700 |
commit | 0a35e5f25bb6b865b90678f0589f97407f461f9c (patch) | |
tree | f99ac4de362be152ee5c99bb962530c93d6ce63d /org.eclipse.jgit.pgm | |
parent | 9fb724f1b9f9f6920852a922abe2c316fc8d25d6 (diff) | |
download | jgit-0a35e5f25bb6b865b90678f0589f97407f461f9c.tar.gz jgit-0a35e5f25bb6b865b90678f0589f97407f461f9c.zip |
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<String, Ref>.
While at it, clarify the javadoc of getRefs and hasRefs to make the
same point.
Suggested-by: David Pursehouse <david.pursehouse@gmail.com>
Change-Id: I23497c66ac7b5e0c987b91efbc9e9cc29924ca66
Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
5 files changed, 5 insertions, 7 deletions
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<Ref> 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<Ref> 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<Ref> getSortedRefs() throws Exception { - List<Ref> all = db.getRefDatabase().getAllRefs(); + List<Ref> 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; |