public static ITypedElement getHeadTypedElement(Repository repository, String repoRelativePath) {
try {
Ref head = repository.getRef(Constants.HEAD);
if (head == null || head.getObjectId() == null)
// Initial import, not yet a HEAD commit
return new EmptyTypedElement(""); //$NON-NLS-1$
RevCommit latestFileCommit;
RevWalk rw = new RevWalk(repository);
try {
RevCommit headCommit = rw.parseCommit(head.getObjectId());