public void prunePacked() throws IOException {ObjectDirectory objdb = repo.getObjectDatabase();Collection<PackFile> packs = objdb.getPacks();File objects = repo.getObjectsDirectory();String[] fanout = objects.list();if (fanout != null && fanout.length > 0) {pm.beginTask(JGitText.get().pruneLoosePackedObjects, fanout.length);try {for (String d : fanout) {checkCancelled();pm.update(1);if (d.length() != 2)continue;String[] entries = new File(objects, d).list();if (entries == null)continue;for (String e : entries) {checkCancelled();if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2)continue;ObjectId id;try {id = ObjectId.fromString(d + e);} catch (IllegalArgumentException notAnObject) {continue;}boolean found = false;for (PackFile p : packs) {checkCancelled();if (p.hasObject(id)) {found = true;break;}}if (found)FileUtils.delete(objdb.fileFor(id), FileUtils.RETRY| FileUtils.SKIP_MISSING| FileUtils.IGNORE_ERRORS);}}} finally {pm.endTask();}}}

public virtual void PrunePacked(){ObjectDirectory objdb = ((ObjectDirectory)repo.ObjectDatabase);ICollection<PackFile> packs = objdb.GetPacks();FilePath objects = repo.ObjectsDirectory;string[] fanout = objects.List();if (fanout != null && fanout.Length > 0){pm.BeginTask(JGitText.Get().pruneLoosePackedObjects, fanout.Length);try{foreach (string d in fanout){pm.Update(1);if (d.Length != 2){continue;}string[] entries = new FilePath(objects, d).List();if (entries == null){continue;}foreach (string e in entries){if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2){continue;}ObjectId id;try{id = ObjectId.FromString(d + e);}catch (ArgumentException){continue;}bool found = false;foreach (PackFile p in packs){if (p.HasObject(id)){found = true;break;}}if (found){FileUtils.Delete(objdb.FileFor(id), FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.IGNORE_ERRORS);}}}}finally{pm.EndTask();}}}
