@@ -2090,7 +2090,7 @@ public void prune(RemoteConfig repository) throws GitException {
2090
2090
2091
2091
Set <String > branches = listRemoteBranches (remote );
2092
2092
2093
- for (Ref r : new ArrayList <>(gitRepo .getAllRefs ().values ())) {
2093
+ for (Ref r : new ArrayList <>(gitRepo .getRefDatabase ().getRefs ())) {
2094
2094
if (r .getName ().startsWith (prefix ) && !branches .contains (r .getName ())) {
2095
2095
// delete this ref
2096
2096
RefUpdate update = gitRepo .updateRef (r .getName ());
@@ -2347,7 +2347,7 @@ public void execute() throws GitException {
2347
2347
out .add (c .copy ());
2348
2348
2349
2349
if (all ) {
2350
- for (Ref r : repo .getAllRefs ().values ()) {
2350
+ for (Ref r : repo .getRefDatabase ().getRefs ()) {
2351
2351
c = walk .parseCommit (r .getObjectId ());
2352
2352
out .add (c .copy ());
2353
2353
}
@@ -2730,7 +2730,13 @@ public List<Branch> getBranchesContaining(String revspec, boolean allBranches)
2730
2730
private List <Ref > getAllBranchRefs (boolean originBranches ) throws GitException {
2731
2731
List <Ref > branches = new ArrayList <>();
2732
2732
try (Repository repo = getRepository ()) {
2733
- for (Ref r : repo .getAllRefs ().values ()) {
2733
+ List <Ref > refs ;
2734
+ try {
2735
+ refs = repo .getRefDatabase ().getRefs ();
2736
+ } catch (IOException ioe ) {
2737
+ throw new GitException (ioe );
2738
+ }
2739
+ for (Ref r : refs ) {
2734
2740
final String branchName = r .getName ();
2735
2741
if (branchName .startsWith (R_HEADS ) || (originBranches && branchName .startsWith (R_REMOTES ))) {
2736
2742
branches .add (r );
@@ -2799,7 +2805,7 @@ private void markAllRefs(RevWalk walk) throws GitException, IOException {
2799
2805
*/
2800
2806
private void markRefs (RevWalk walk , Predicate <Ref > filter ) throws GitException , IOException {
2801
2807
try (Repository repo = getRepository ()) {
2802
- for (Ref r : repo .getAllRefs ().values ()) {
2808
+ for (Ref r : repo .getRefDatabase ().getRefs ()) {
2803
2809
if (filter .test (r )) {
2804
2810
RevCommit c = walk .parseCommit (r .getObjectId ());
2805
2811
walk .markStart (c );
@@ -2919,7 +2925,7 @@ public String describe(String tip) throws GitException, InterruptedException {
2919
2925
w .setRetainBody (false );
2920
2926
2921
2927
Map <ObjectId , Ref > tags = new HashMap <>();
2922
- for (Ref r : repo .getTags ().values ( )) {
2928
+ for (Ref r : repo .getRefDatabase ().getRefsByPrefix ( R_TAGS )) {
2923
2929
ObjectId key = repo .getRefDatabase ().peel (r ).getPeeledObjectId ();
2924
2930
if (key == null ) {
2925
2931
key = r .getObjectId ();
0 commit comments