git fetch --prune only since 1.7.0

Lazy to determine the concrete version, since it is a minor functionality.
This commit is contained in:
Kirill Likhodedov
2012-02-16 16:26:41 +04:00
parent e1a420b9c1
commit 36fdb7fc87
2 changed files with 13 additions and 1 deletions
@@ -73,6 +73,13 @@ public enum GitVersionSpecialty {
}
},
SUPPORTS_FETCH_PRUNE {
@Override
public boolean existsIn(@NotNull GitVersion version) {
return version.isLaterOrEqual(new GitVersion(1, 7, 0, 0));
}
},
DOESNT_DEFINE_HOME_ENV_VAR {
@Override
public boolean existsIn(@NotNull GitVersion version) {
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import git4idea.GitVcs;
import git4idea.NotificationManager;
import git4idea.commands.*;
import git4idea.config.GitVersionSpecialty;
import git4idea.jgit.GitHttpAdapter;
import git4idea.repo.GitRemote;
import git4idea.repo.GitRepository;
@@ -52,6 +53,7 @@ public class GitFetcher {
private final Project myProject;
private final GitRepositoryManager myRepositoryManager;
private final ProgressIndicator myProgressIndicator;
private final GitVcs myVcs;
private final Collection<Exception> myErrors = new ArrayList<Exception>();
@@ -59,6 +61,7 @@ public class GitFetcher {
myProject = project;
myProgressIndicator = progressIndicator;
myRepositoryManager = GitRepositoryManager.getInstance(project);
myVcs = GitVcs.getInstance(project);
}
/**
@@ -101,7 +104,9 @@ public class GitFetcher {
private GitFetchResult fetchNatively(@NotNull VirtualFile root, @NotNull GitRemote remote) {
final GitLineHandlerPasswordRequestAware h = new GitLineHandlerPasswordRequestAware(myProject, root, GitCommand.FETCH);
h.addParameters("--prune");
if (GitVersionSpecialty.SUPPORTS_FETCH_PRUNE.existsIn(myVcs.getVersion())) {
h.addParameters("--prune");
}
h.addParameters(remote.getName());
final GitTask fetchTask = new GitTask(myProject, h, "Fetching...");
fetchTask.setProgressIndicator(myProgressIndicator);