Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick2012-01-09 11:13:12 +0000
committerCode Review2012-01-09 11:13:12 +0000
commit885a38983243d22fb756516ee108ec9ca909a9af (patch)
treef717e59ddf0bc827423219ff8c6893bc85b77eff
parent0f15d656f26d48516eee661bacfd7e9750b35ab3 (diff)
parent3d15298011b769ef9797ba7a71ccb8fa538810e1 (diff)
downloadjgit-885a38983243d22fb756516ee108ec9ca909a9af.tar.gz
jgit-885a38983243d22fb756516ee108ec9ca909a9af.tar.xz
jgit-885a38983243d22fb756516ee108ec9ca909a9af.zip
Merge "Add helper for determining if status is clean"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java
index e1491da374..8ebd279aa7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java
@@ -60,7 +60,9 @@ import org.eclipse.jgit.lib.IndexDiff;
* {@link #getChanged()}
*/
public class Status {
- private IndexDiff diff;
+ private final IndexDiff diff;
+
+ private final boolean clean;
/**
* @param diff
@@ -68,6 +70,21 @@ public class Status {
public Status(IndexDiff diff) {
super();
this.diff = diff;
+ clean = diff.getAdded().isEmpty() //
+ && diff.getChanged().isEmpty() //
+ && diff.getRemoved().isEmpty() //
+ && diff.getMissing().isEmpty() //
+ && diff.getModified().isEmpty() //
+ && diff.getUntracked().isEmpty() //
+ && diff.getConflicting().isEmpty();
+ }
+
+ /**
+ * @return true if no differences exist between the working-tree, the index,
+ * and the current HEAD, false if differences do exist
+ */
+ public boolean isClean() {
+ return clean;
}
/**

Back to the top