*/
public Ref call() throws GitAPIException, CheckoutConflictException {
checkCallable();
try {
RepositoryState state = repo.getRepositoryState();
final boolean merging = state.equals(RepositoryState.MERGING)
|| state.equals(RepositoryState.MERGING_RESOLVED);
final boolean cherryPicking = state
.equals(RepositoryState.CHERRY_PICKING)
|| state.equals(RepositoryState.CHERRY_PICKING_RESOLVED);
final boolean reverting = state.equals(RepositoryState.REVERTING)
|| state.equals(RepositoryState.REVERTING_RESOLVED);
final ObjectId commitId = resolveRefToCommitId();
// When ref is explicitly specified, it has to resolve
if (ref != null && commitId == null) {
// @TODO throw an InvalidRefNameException. We can't do that