summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2014-10-13 16:41:58 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2014-10-13 16:41:58 +0200
commit13ffda0666cec94183529307eecbbda3bcf12fb1 (patch)
tree0064037bdcd44a2adc89907ed67f7d1612143275 /org.eclipse.jgit.test
parent74c337eadb76880e5c9a72c019272c32c4885221 (diff)
downloadjgit-13ffda0666cec94183529307eecbbda3bcf12fb1.tar.gz
jgit-13ffda0666cec94183529307eecbbda3bcf12fb1.zip
Fix ResetCommand to default to mixed reset
ResetCommand threw an NPE if neither mode nor path was defined. Instead it should default to a mixed reset like native git does. Change-Id: I455902394f9e7b0c7afae42381f34838f7f2a138 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
index 82249766ad..c48b412401 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java
@@ -425,6 +425,21 @@ public class ResetCommandTest extends RepositoryTestCase {
}
@Test
+ public void testResetDefaultMode() throws Exception {
+ git = new Git(db);
+ writeTrashFile("a.txt", "content");
+ git.add().addFilepattern("a.txt").call();
+ writeTrashFile("a.txt", "modified");
+ // should use default mode MIXED
+ git.reset().call();
+
+ DirCache cache = db.readDirCache();
+ DirCacheEntry aEntry = cache.getEntry("a.txt");
+ assertNull(aEntry);
+ assertEquals("modified", read("a.txt"));
+ }
+
+ @Test
public void testHardResetOnTag() throws Exception {
setupRepository();
String tagName = "initialtag";