mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user