/** * @param fetchAll Pass {@code true} to fetch all remotes and all branches (like {@code git fetch} * without parameters does). Pass {@code false} to fetch only the tracked branch of the * current branch. */ public GitFetcher( @NotNull Project project, @NotNull ProgressIndicator progressIndicator, boolean fetchAll) { myProject = project; myProgressIndicator = progressIndicator; myFetchAll = fetchAll; myRepositoryManager = GitUtil.getRepositoryManager(myProject); myVcs = GitVcs.getInstance(project); }
@NotNull public GitFetchResult fetch(@NotNull VirtualFile root, @NotNull String remoteName) { GitRepository repository = myRepositoryManager.getRepositoryForRoot(root); if (repository == null) { return logError("Repository can't be null for " + root, myRepositoryManager.toString()); } GitRemote remote = GitUtil.findRemoteByName(repository, remoteName); if (remote == null) { return logError("Couldn't find remote with the name " + remoteName, null); } String url = remote.getFirstUrl(); if (url == null) { return logError("URL is null for remote " + remote.getName(), null); } return fetchRemote(repository, remote, url); }