@Nullable private String doLoadDefaultBranch( @NotNull final GithubFullPath fork, @NotNull ProgressIndicator indicator) throws IOException { GithubRepo repo = GithubUtil.runTask( myProject, myAuthHolder, indicator, new ThrowableConvertor<GithubConnection, GithubRepo, IOException>() { @Override public GithubRepo convert(@NotNull GithubConnection connection) throws IOException { return GithubApiUtil.getDetailedRepoInfo( connection, fork.getUser(), fork.getRepository()); } }); return repo.getDefaultBranch(); }
@Nullable private ForkInfo doAddFork(@NotNull GithubRepo repo, @NotNull ProgressIndicator indicator) { GithubFullPath path = repo.getFullPath(); for (ForkInfo fork : myForks) { if (fork.getPath().equals(path)) { return fork; } } try { List<String> branches = loadBranches(path, indicator); String defaultBranch = repo.getDefaultBranch(); ForkInfo fork = new ForkInfo(path, branches, defaultBranch); myForks.add(fork); return fork; } catch (IOException e) { GithubNotifications.showWarning( myProject, "Can't load branches for " + path.getFullName(), e); return null; } }