use of org.eclipse.jgit.lib.IndexDiff.StageState in project indy by Commonjava.
the class GitManager method commitModifiedFiles.
public GitManager commitModifiedFiles(final ChangeSummary changeSummary) throws GitSubsystemException {
lockAnd((me) -> {
Status status;
try {
status = git.status().call();
} catch (NoWorkTreeException | GitAPIException e) {
throw new GitSubsystemException("Failed to retrieve status of: %s. Reason: %s", e, rootDir, e.getMessage());
}
final Map<String, StageState> css = status.getConflictingStageState();
if (!css.isEmpty()) {
throw new GitSubsystemException("%s contains conflicts. Cannot auto-commit.\n %s", rootDir, new JoinString("\n ", css.entrySet()));
}
final Set<String> toAdd = new HashSet<>();
final Set<String> modified = status.getModified();
if (modified != null && !modified.isEmpty()) {
toAdd.addAll(modified);
}
final Set<String> untracked = status.getUntracked();
if (untracked != null && !untracked.isEmpty()) {
toAdd.addAll(untracked);
}
final Set<String> untrackedFolders = status.getUntrackedFolders();
if (untrackedFolders != null && !untrackedFolders.isEmpty()) {
toAdd.addAll(untrackedFolders);
// for ( String folderPath : untrackedFolders )
// {
// File dir = new File( rootDir, folderPath );
// Files.walkFileTree( null, null )
// }
}
if (!toAdd.isEmpty()) {
addAndCommitPaths(changeSummary, toAdd);
}
return me;
});
return this;
}
Aggregations