aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2010-05-07 15:27:44 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2010-05-08 22:03:18 +0200
commitb9ab040b45f0a0329d76fc919b0111414fdaf035 (patch)
treef90492ff663629a2d87db4450a204f343279bbe8 /org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
parentdd63f5cfc17d6f52a54e0c6442ea3bed42043b36 (diff)
downloadjgit-b9ab040b45f0a0329d76fc919b0111414fdaf035.tar.gz
jgit-b9ab040b45f0a0329d76fc919b0111414fdaf035.zip
Added MERGING_RESOLVED repository state
The repository state tells in which state the repo is and also which actions are currently allowed. The state MERGING is telling that a commit is not possible. But this is only true in the case of unmerged paths in the index. When we are merging but have resolved all conflicts then we are in a special state: We are still merging (means the next commit should have multiple parents) but a commit is now allowed. Since the MERGING state "canCommit()" cannot be enhanced to return true/false based on the index state (MERGING is an enum value which does not have a reference to the repository its state it is representing) I had to introduce a new state MERGING_RESOLVED. This new state will report that a commit is possible. CAUTION: there might be the chance that users of jgit previously blindly did a plain commit (with only one parent) when the RepositoryState allowed them to do so. With this change these users will now be confronted with a RepositoryState which says a commit is possible but before they can commit they'll have to check the MERGE_MESSAGE and MERGE_HEAD files and use the info from these files. Change-Id: I0a885e2fe8c85049fb23722351ab89cf2c81a431 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
index 6159839b13..901d1b516b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
@@ -74,6 +74,17 @@ public enum RepositoryState {
},
/**
+ * An merge where all conflicts have been resolved. The index does not
+ * contain any unmerged paths.
+ */
+ MERGING_RESOLVED {
+ public boolean canCheckout() { return true; }
+ public boolean canResetHead() { return true; }
+ public boolean canCommit() { return true; }
+ public String getDescription() { return "Merged"; }
+ },
+
+ /**
* An unfinished rebase or am. Must resolve, skip or abort before normal work can take place
*/
REBASING {