- @Nullable
- private static GitBranchPair findSourceDestForBranch(GitRepository repository, GitBranch branch) throws VcsException {
- GitBranch trackedBranch = branch.tracked(repository.getProject(), repository.getRoot());
- if (trackedBranch != null) {
- return new GitBranchPair(branch, trackedBranch);
- }
- Pair<GitRemote,GitBranch> remoteAndBranch = GitUtil.findMatchingRemoteBranch(repository, branch);
- if (remoteAndBranch == null) {
- return null;
- }
- GitBranch matchingRemoteBranch = remoteAndBranch.getSecond();
- if (matchingRemoteBranch != null) {
- return new GitBranchPair(branch, matchingRemoteBranch);
- }
- return null;
- }
-