GC.prune(Set<ObjectId>): return early if objects directory is empty
Change-Id: Id56b102604c4e0437230e3e7c59c0a3a1b676256 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
8fd500e20c
commit
a11bb03127
|
@ -364,7 +364,9 @@ public void prune(Set<ObjectId> objectsToKeep) throws IOException,
|
||||||
Set<ObjectId> indexObjects = null;
|
Set<ObjectId> indexObjects = null;
|
||||||
File objects = repo.getObjectsDirectory();
|
File objects = repo.getObjectsDirectory();
|
||||||
String[] fanout = objects.list();
|
String[] fanout = objects.list();
|
||||||
if (fanout != null && fanout.length > 0) {
|
if (fanout == null || fanout.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
pm.beginTask(JGitText.get().pruneLooseUnreferencedObjects,
|
pm.beginTask(JGitText.get().pruneLooseUnreferencedObjects,
|
||||||
fanout.length);
|
fanout.length);
|
||||||
try {
|
try {
|
||||||
|
@ -400,9 +402,10 @@ public void prune(Set<ObjectId> objectsToKeep) throws IOException,
|
||||||
} finally {
|
} finally {
|
||||||
pm.endTask();
|
pm.endTask();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (deletionCandidates.isEmpty())
|
if (deletionCandidates.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// From the set of current refs remove all those which have been handled
|
// From the set of current refs remove all those which have been handled
|
||||||
// during last repack(). Only those refs will survive which have been
|
// during last repack(). Only those refs will survive which have been
|
||||||
|
|
Loading…
Reference in New Issue