List of usage examples for org.eclipse.jgit.api Status Status
public Status(IndexDiff diff)
From source file:com.rimerosolutions.ant.git.tasks.UpToDateTask.java
License:Apache License
@Override protected void doExecute() throws BuildException { Repository repo = git.getRepository(); FileTreeIterator workingTreeIterator = new FileTreeIterator(repo); try {//from w w w . j a v a2 s . c o m IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIterator); diff.diff(); Status status = new Status(diff); if (!status.isClean()) { if (modificationExistProperty != null) { getProject().setProperty(modificationExistProperty, "true"); } if (isFailOnError()) { StringBuilder msg = new StringBuilder(); msg.append("The Git tree was modified."); msg.append("\n").append("Changed:").append(status.getChanged()); msg.append("\n").append("Added:").append(status.getAdded()); msg.append("\n").append("Modified:").append(status.getModified()); msg.append("\n").append("Missing:").append(status.getMissing()); msg.append("\n").append("Removed:").append(status.getRemoved()); msg.append("\n").append("Untracked:").append(status.getUntracked()); throw new GitBuildException(String.format(STATUS_NOT_CLEAN_TEMPLATE, msg.toString())); } } else { log(MESSAGE_UPTODATE_SUCCESS); } } catch (IOException ioe) { throw new GitBuildException(MESSAGE_UPTODATE_FAILED, ioe); } }