Merge "Fix gc's usage of progress monitor"
This commit is contained in:
commit
47e4e9b177
|
@ -137,6 +137,7 @@ public GC(FileRepository repo) {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public Collection<PackFile> gc() throws IOException {
|
public Collection<PackFile> gc() throws IOException {
|
||||||
|
pm.start(6 /* tasks */);
|
||||||
packRefs();
|
packRefs();
|
||||||
// TODO: implement reflog_expire(pm, repo);
|
// TODO: implement reflog_expire(pm, repo);
|
||||||
Collection<PackFile> newPacks = repack();
|
Collection<PackFile> newPacks = repack();
|
||||||
|
@ -262,34 +263,38 @@ public void prune(Set<ObjectId> objectsToKeep)
|
||||||
if (fanout != null && fanout.length > 0) {
|
if (fanout != null && fanout.length > 0) {
|
||||||
pm.beginTask(JGitText.get().pruneLooseUnreferencedObjects,
|
pm.beginTask(JGitText.get().pruneLooseUnreferencedObjects,
|
||||||
fanout.length);
|
fanout.length);
|
||||||
for (String d : fanout) {
|
try {
|
||||||
pm.update(1);
|
for (String d : fanout) {
|
||||||
if (d.length() != 2)
|
pm.update(1);
|
||||||
continue;
|
if (d.length() != 2)
|
||||||
File[] entries = new File(objects, d).listFiles();
|
|
||||||
if (entries == null)
|
|
||||||
continue;
|
|
||||||
for (File f : entries) {
|
|
||||||
String fName = f.getName();
|
|
||||||
if (fName.length() != Constants.OBJECT_ID_STRING_LENGTH - 2)
|
|
||||||
continue;
|
continue;
|
||||||
if (f.lastModified() >= expireDate)
|
File[] entries = new File(objects, d).listFiles();
|
||||||
|
if (entries == null)
|
||||||
continue;
|
continue;
|
||||||
try {
|
for (File f : entries) {
|
||||||
ObjectId id = ObjectId.fromString(d + fName);
|
String fName = f.getName();
|
||||||
if (objectsToKeep.contains(id))
|
if (fName.length() != Constants.OBJECT_ID_STRING_LENGTH - 2)
|
||||||
continue;
|
continue;
|
||||||
if (indexObjects == null)
|
if (f.lastModified() >= expireDate)
|
||||||
indexObjects = listNonHEADIndexObjects();
|
|
||||||
if (indexObjects.contains(id))
|
|
||||||
continue;
|
continue;
|
||||||
deletionCandidates.put(id, f);
|
try {
|
||||||
} catch (IllegalArgumentException notAnObject) {
|
ObjectId id = ObjectId.fromString(d + fName);
|
||||||
// ignoring the file that does not represent loose
|
if (objectsToKeep.contains(id))
|
||||||
// object
|
continue;
|
||||||
continue;
|
if (indexObjects == null)
|
||||||
|
indexObjects = listNonHEADIndexObjects();
|
||||||
|
if (indexObjects.contains(id))
|
||||||
|
continue;
|
||||||
|
deletionCandidates.put(id, f);
|
||||||
|
} catch (IllegalArgumentException notAnObject) {
|
||||||
|
// ignoring the file that does not represent loose
|
||||||
|
// object
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
pm.endTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deletionCandidates.isEmpty())
|
if (deletionCandidates.isEmpty())
|
||||||
|
|
Loading…
Reference in New Issue