/*******************************************************************************
 * Copyright (C) 2012, Matthias Sohn <matthias.sohn@sap.com>
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.egit.core.op;

import java.io.IOException;
import java.text.ParseException;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.egit.core.Activator;
import org.eclipse.egit.core.EclipseGitProgressTransformer;
import org.eclipse.egit.core.internal.job.RuleUtil;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.internal.storage.file.FileRepository;
import org.eclipse.jgit.internal.storage.file.GC;

/**
 * Operation to garbage collect a git repository
 */
public class GarbageCollectOperation implements IEGitOperation {

	private Repository repository;

	/**
	 * @param repository the repository to garbage collect
	 */
	public GarbageCollectOperation(Repository repository) {
		this.repository = repository;
	}

	/**
	 * Execute garbage collection
	 */
	public void execute(IProgressMonitor monitor) throws CoreException {
		GC gc = new GC((FileRepository) repository);
		gc.setProgressMonitor(new EclipseGitProgressTransformer(
				monitor));
		try {
			gc.gc();
		} catch (IOException e) {
			throw new CoreException(new Status(IStatus.ERROR,
					Activator.getPluginId(), e.getMessage(), e));
		} catch (ParseException e) {
			throw new CoreException(new Status(IStatus.ERROR,
					Activator.getPluginId(), e.getMessage(), e));
		}
	}

	public ISchedulingRule getSchedulingRule() {
		return RuleUtil.getRule(repository);
	}

}

@@ -96,16 +96,21 @@
 C) 2012,
+ 2013
  Matthia
@@ -139,16 +139,28 @@
 sap.com%3E
+ and others.
 %0A *%0A * A
@@ -522,70 +522,8 @@
 p;%0A%0A
-import java.io.IOException;%0Aimport java.text.ParseException;%0A%0A
 impo
@@ -930,22 +930,15 @@
 git.
-lib.Repository
+api.Git
 ;%0Aim
@@ -963,44 +963,34 @@
 git.
-internal.storage.file.FileRepository
+api.errors.GitAPIException
 ;%0Aim
@@ -1015,32 +1015,22 @@
 git.
-internal.storage.file.GC
+lib.Repository
 ;%0A%0A/
@@ -1461,20 +1461,22 @@
 %0A%09%09G
-C gc
+it git
  = new G
 C((F
@@ -1475,64 +1475,61 @@
 ew G
-C((FileRepository) repository);%0A%09%09gc.setProgressMonitor(
+it(repository);%0A%09%09EclipseGitProgressTransformer pm = 
 new 
@@ -1571,17 +1571,16 @@
 monitor)
-)
 ;%0A%09%09try 
@@ -1589,145 +1589,44 @@
 %09%09%09g
-c
+it
 .gc()
-;%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09throw new CoreException(new Status(IStatus.ERROR,%0A%09%09%09%09%09Activator.getPluginId(), e.getMessage(), e)
+.setProgressMonitor(pm).call(
 );%0A%09
@@ -1639,13 +1639,14 @@
 ch (
-Parse
+GitAPI
 Exce

Replace use of internal GC class by command in GarbageCollectOperation