summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorStefan Lay <stefan.lay@sap.com>2012-08-28 03:02:19 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2012-08-28 03:02:19 -0400
commit47e4e9b177ac536356ad620e976671d24e4939ba (patch)
treeec23176da428c29c70476a1afcc2ac6640f9f5f7 /org.eclipse.jgit
parent9893e9a880efcc5c2156b33c98435dd365d29d6e (diff)
parent29d9fc478c3046f50b95e8a85d42fe6205afb01d (diff)
downloadjgit-47e4e9b177ac536356ad620e976671d24e4939ba.tar.gz
jgit-47e4e9b177ac536356ad620e976671d24e4939ba.zip
Merge "Fix gc's usage of progress monitor"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java49
1 files changed, 27 insertions, 22 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java
index cb053c18a6..60d9cd0c02 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/GC.java
@@ -137,6 +137,7 @@ public class GC {
* @throws IOException
*/
public Collection<PackFile> gc() throws IOException {
+ pm.start(6 /* tasks */);
packRefs();
// TODO: implement reflog_expire(pm, repo);
Collection<PackFile> newPacks = repack();
@@ -262,34 +263,38 @@ public class GC {
if (fanout != null && fanout.length > 0) {
pm.beginTask(JGitText.get().pruneLooseUnreferencedObjects,
fanout.length);
- for (String d : fanout) {
- pm.update(1);
- if (d.length() != 2)
- continue;
- 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)
+ try {
+ for (String d : fanout) {
+ pm.update(1);
+ if (d.length() != 2)
continue;
- if (f.lastModified() >= expireDate)
+ File[] entries = new File(objects, d).listFiles();
+ if (entries == null)
continue;
- try {
- ObjectId id = ObjectId.fromString(d + fName);
- if (objectsToKeep.contains(id))
+ for (File f : entries) {
+ String fName = f.getName();
+ if (fName.length() != Constants.OBJECT_ID_STRING_LENGTH - 2)
continue;
- if (indexObjects == null)
- indexObjects = listNonHEADIndexObjects();
- if (indexObjects.contains(id))
+ if (f.lastModified() >= expireDate)
continue;
- deletionCandidates.put(id, f);
- } catch (IllegalArgumentException notAnObject) {
- // ignoring the file that does not represent loose
- // object
- continue;
+ try {
+ ObjectId id = ObjectId.fromString(d + fName);
+ if (objectsToKeep.contains(id))
+ 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())