Optional<GitRepository> gitRepositoryOptional = gerritGitUtil.getRepositoryForGerritProject(project, changeInfo.project);
if (!gitRepositoryOptional.isPresent()) return;
GitRepository gitRepository = gitRepositoryOptional.get();
final String branchName = "FETCH_HEAD";
GitLocalBranch currentBranch = gitRepository.getCurrentBranch();
final String currentBranchName;
if (currentBranch != null) {
currentBranchName = currentBranch.getFullName();
} else {
currentBranchName = gitRepository.getCurrentRevision();
}
assert currentBranch != null : "Current branch is neither a named branch nor a revision";