* @throws MavanagaiataMojoException if retrieving information from the Git
* repository fails
*/
public void run() throws MavanagaiataMojoException {
try {
GitCommit commit = this.repository.getHeadCommit();
String abbrevId = this.repository.getAbbreviatedCommitId();
String shaId = commit.getId();
boolean isDirty = false;
SimpleDateFormat dateFormat = new SimpleDateFormat(this.dateFormat);
dateFormat.setTimeZone(commit.getAuthorTimeZone());
String authorDate = dateFormat.format(commit.getAuthorDate());
dateFormat.setTimeZone(commit.getCommitterTimeZone());
String commitDate = dateFormat.format(commit.getCommitterDate());
if (this.repository.isDirty(this.dirtyIgnoreUntracked)) {
isDirty = true;
if (this.dirtyFlag != null) {
abbrevId += this.dirtyFlag;
shaId += this.dirtyFlag;
}
}
this.addProperty("commit.abbrev", abbrevId);
this.addProperty("commit.author.date", authorDate);
this.addProperty("commit.author.name", commit.getAuthorName());
this.addProperty("commit.author.email", commit.getAuthorEmailAddress());
this.addProperty("commit.committer.date", commitDate);
this.addProperty("commit.committer.name", commit.getCommitterName());
this.addProperty("commit.committer.email", commit.getCommitterEmailAddress());
this.addProperty("commit.id", shaId);
this.addProperty("commit.sha", shaId);
this.addProperty("commit.dirty", String.valueOf(isDirty));
} catch (GitRepositoryException e) {
throw MavanagaiataMojoException.create("Unable to read Git commit information", e);