FetchParams (@NotNull GitRepository repository) { GitLocalBranch currentBranch = repository.getCurrentBranch(); if (currentBranch == null) { // fetching current branch is called from Update Project and Push, where branch tracking is pre-checked String message = "Current branch can't be null here. \nRepository: " + repository; LOG.error(message); return new FetchParams(GitFetchResult.error(new Exception(message))); } GitBranchTrackInfo trackInfo = GitBranchUtil.getTrackInfoForBranch(repository, currentBranch); if (trackInfo == null) { String message = "Tracked info is null for branch " + currentBranch + "\n Repository: " + repository; LOG.error(message); return new FetchParams(GitFetchResult.error(new Exception(message))); } GitRemote remote = trackInfo.getRemote(); return new FetchParams(remote, trackInfo.getRemoteBranch()); }