@Override
public void run(@NotNull ProgressIndicator indicator) {
GitRemote remote;
String fetch;
String url;
boolean commitIsFetched = checkIfCommitIsFetched(gitRepository, commitHash);
if (commitIsFetched) {
remote = new GitRemote(gitRepository.getRoot().getPath(),
Collections.<String>emptyList(), Collections.<String>emptySet(), Collections.<String>emptyList(), Collections.<String>emptyList());
fetch = commitHash;
url = "";
} else {
remote = getRemoteForChange(project, gitRepository, fetchInfo).orNull();
if (remote == null) {
return;
}
fetch = fetchInfo.ref;
url = remote.getFirstUrl();
}
GitFetchResult result = fetchNatively(gitRepository.getGitDir(), remote, url, fetch, project, indicator);
if (!result.isSuccess()) {
GitFetcher.displayFetchResult(project, result, null, result.getErrors());
}
}
});