private @Nullable GitLocalBranch findCurrentBranch(@NotNull HeadInfo headInfo,
                                                     @NotNull Repository.State state,
                                                     @NotNull Set<GitLocalBranch> localBranches) {
    final String currentBranchName = findCurrentBranchName(state, headInfo);
    if (currentBranchName == null) {
      return null;
    }
    final GitLocalBranch currentBranch =
      ContainerUtil.find(localBranches, branch -> BRANCH_NAME_HASHING_STRATEGY.equals(branch.getFullName(), currentBranchName));
    return currentBranch == null ? new GitLocalBranch(currentBranchName) : currentBranch;
  }
private @Nullable GitLocalBranch findCurrentBranch(@NotNull HeadInfo headInfo,
                                                     @NotNull Repository.State state,
                                                     @NotNull Set<GitLocalBranch> localBranches)