Quellcode durchsuchen

Enhance RefDatabase with a refresh() method

There should be a way to explictly refresh the refs cached in the
RefDirectory. Since commit c261b28 (use of FileSnapshot) this is
not needed anymore for storage in the filesystem. But for DHT based
storage an explicit refresh may be needed.

Change-Id: I7d30c3496c05e1fb6e9519f3af9f23c6adb93bf9
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
tags/v0.12.1
Christian Halstrick vor 13 Jahren
Ursprung
Commit
ffbaf694e2

+ 11
- 0
org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java Datei anzeigen

@@ -209,4 +209,15 @@ public abstract class RefDatabase {
* the reference space or object space cannot be accessed.
*/
public abstract Ref peel(Ref ref) throws IOException;

/**
* Triggers a refresh of all internal data structures.
* <p>
* In case the RefDatabase implementation has internal caches this method
* will trigger that all these caches are cleared.
* <p>
* Implementors should overwrite this method if they use any kind of caches.
*/
public void refresh() {
}
}

+ 6
- 0
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/RefDirectory.java Datei anzeigen

@@ -211,6 +211,12 @@ public class RefDirectory extends RefDatabase {
packedRefs.set(PackedRefList.NO_PACKED_REFS);
}

@Override
public void refresh() {
super.refresh();
rescan();
}

@Override
public boolean isNameConflicting(String name) throws IOException {
RefList<Ref> packed = getPackedRefs();

Laden…
Abbrechen
Speichern