use of org.eclipse.jgit.errors.RevisionSyntaxException in project egit by eclipse.
the class GitFlowRepository method findHead.
/**
* @param branchName
* @return HEAD commit on branch branchName or {@literal null} if
* {@code branchName} could not be resolved.
*/
@Nullable
public RevCommit findHead(String branchName) {
try (RevWalk walk = new RevWalk(repository)) {
try {
String revstr = R_HEADS + branchName;
ObjectId head = repository.resolve(revstr);
if (head == null) {
return null;
}
return walk.parseCommit(head);
} catch (RevisionSyntaxException | IOException e) {
throw new RuntimeException(e);
}
}
}
Aggregations