Skip to content
Snippets Groups Projects
Commit c466809a authored by Georg Seibt's avatar Georg Seibt :nerd:
Browse files

add options to include ignored/untracked files

parent 8d497e86
No related branches found
No related tags found
No related merge requests found
......@@ -552,14 +552,37 @@ public class Repository {
return Optional.of(conflicts);
}
/**
* Parses and returns the current output of 'git status' for this {@link Repository}. This includes untracked files
* but excludes ignored files. If there is an exception parsing or obtaining the status output, an empty
* {@link Optional} will be returned.
*
* @return optionally the {@link Status} of this {@link Repository}
*/
public Optional<Status> getStatus() {
return getStatus(false, true);
}
/**
* Parses and returns the current output of 'git status' for this {@link Repository}.
* If there is an exception parsing or obtaining the status output, an empty {@link Optional} will be returned.
*
* @param ignored
* whether to include ignored files in the {@link Status}
* @param untracked
* whether to include untracked files in the {@link Status}
* @return optionally the {@link Status} of this {@link Repository}
*/
public Optional<Status> getStatus() {
Optional<ExecRes> output = git.exec(dir, "status", "-z");
public Optional<Status> getStatus(boolean ignored, boolean untracked) {
Optional<ExecRes> output;
String untrackedPar = "--untracked=" + (untracked ? "all" : "no");
if (ignored) {
output = git.exec(dir, "status", untrackedPar, "--ignored", "-z");
} else {
output = git.exec(dir, "status", untrackedPar, "-z");
}
Function<ExecRes, Optional<Status>> toStatus = execRes -> {
if (git.failed(execRes)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment