Example usage for org.eclipse.jgit.util RefList emptyList

List of usage examples for org.eclipse.jgit.util RefList emptyList

Introduction

In this page you can find the example usage for org.eclipse.jgit.util RefList emptyList.

Prototype

@SuppressWarnings("unchecked")
public static <T extends Ref> RefList<T> emptyList() 

Source Link

Document

Create an empty unmodifiable reference list.

Usage

From source file:org.chodavarapu.jgitaws.jgit.DynamoRefDatabase.java

License:Eclipse Distribution License

@Override
protected RefCache scanAllRefs() throws IOException {
    logger.debug("Retrieving refs for repository {}", getRepository().getRepositoryName());

    RefCache cache = configuration.getRefRepository().getAllRefsSorted(getRepository().getRepositoryName())
            .toList().map(refs -> {//from w w  w .  j  a  va  2  s .  c  o m
                RefList.Builder<Ref> allRefs = new RefList.Builder<>();
                RefList.Builder<Ref> onlySymbolicRefs = new RefList.Builder<>();

                for (Ref ref : refs) {
                    allRefs.add(ref);

                    if (ref.isSymbolic())
                        onlySymbolicRefs.add(ref);
                }

                return new RefCache(allRefs.toRefList(), onlySymbolicRefs.toRefList());
            }).toBlocking().lastOrDefault(new RefCache(RefList.emptyList(), RefList.emptyList()));

    logger.debug("Retrieved {} refs for repository {}", cache.size(), getRepository().getRepositoryName());
    return cache;
}