private File indexFile;
+ private File indexNestedFile;
+
private File untrackedFile;
private DirCacheEntry prestage;
indexFile = writeTrashFile("a.txt", "content");
// create nested file
- writeTrashFile("dir/b.txt", "content");
+ indexNestedFile = writeTrashFile("dir/b.txt", "content");
// add files and commit them
git.add().addFilepattern("a.txt").addFilepattern("dir/b.txt").call();
AmbiguousObjectException, IOException, GitAPIException {
setupRepository();
ObjectId prevHead = db.resolve(Constants.HEAD);
- assertSameAsHead(git.reset().setMode(ResetType.HARD)
+ ResetCommand reset = git.reset();
+ assertSameAsHead(reset.setMode(ResetType.HARD)
.setRef(initialCommit.getName()).call());
+ assertFalse("reflog should be enabled", reset.isReflogDisabled());
// check if HEAD points to initial commit now
ObjectId head = db.resolve(Constants.HEAD);
assertEquals(initialCommit, head);
// check if files were removed
assertFalse(indexFile.exists());
+ assertFalse(indexNestedFile.exists());
assertTrue(untrackedFile.exists());
// fileInIndex must no longer be in HEAD and in the index
String fileInIndexPath = indexFile.getAbsolutePath();
assertEquals(initialCommit, head);
// check if files were removed
assertFalse(indexFile.exists());
+ assertFalse(indexNestedFile.exists());
assertTrue(untrackedFile.exists());
// fileInIndex must no longer be in HEAD and in the index
String fileInIndexPath = indexFile.getAbsolutePath();