use of com.oxygenxml.git.view.dialog.DetachedHeadDialog in project oxygen-git-client-addon by oxygenxml.
the class OxygenGitPluginExtension method treatDetachedHead.
/**
* Treat detached HEAD.
*
* @param wcEventInfo event info.
*/
private void treatDetachedHead(WorkingCopyGitEventInfo wcEventInfo) {
if (wcEventInfo.isWorkingCopySubmodule()) {
return;
}
Repository repo = null;
try {
repo = GitAccess.getInstance().getRepository();
} catch (NoRepositorySelected e) {
LOGGER.error(e.getMessage(), e);
}
if (repo != null && repo.getRepositoryState() != RepositoryState.REBASING_MERGE) {
String commitFullID = GitAccess.getInstance().getBranchInfo().getBranchName();
try (RevWalk revWalk = new RevWalk(repo)) {
RevCommit commit = revWalk.parseCommit(repo.resolve(commitFullID));
DetachedHeadDialog dlg = new DetachedHeadDialog(commit);
dlg.setVisible(true);
} catch (RevisionSyntaxException | IOException e) {
LOGGER.debug(e.getMessage(), e);
}
}
}
Aggregations