diff options
author | Robin Stocker <robin@nibor.org> | 2012-12-03 14:59:39 +0100 |
---|---|---|
committer | Chris Aniszczyk <zx@twitter.com> | 2012-12-03 10:40:54 -0600 |
commit | beb16cec2614f6f95f258f4cfcc8258ca72db3b2 (patch) | |
tree | 17e00fbd6241a1e454f986f332bc3e62dcbbc1bd /org.eclipse.jgit.test | |
parent | b46b27e3897d5a78d0d3b5766309ee853346c182 (diff) | |
download | jgit-beb16cec2614f6f95f258f4cfcc8258ca72db3b2.tar.gz jgit-beb16cec2614f6f95f258f4cfcc8258ca72db3b2.zip |
Support --cached in RmCommand
Also extend documentation and add examples.
Bug: 395599
Change-Id: Id1ddbc9da787472f82e58834092bc073224b262b
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java index 2eb4f22940..0323ba3f8a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RmCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com> + * Copyright (C) 2010, 2012 Chris Aniszczyk <caniszczyk@gmail.com> * and other copyright owners as documented in the project's IP log. * * This program and the accompanying materials are made available @@ -43,7 +43,9 @@ package org.eclipse.jgit.api; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.io.File; import java.io.IOException; import org.eclipse.jgit.api.errors.GitAPIException; @@ -80,4 +82,16 @@ public class RmCommandTest extends RepositoryTestCase { assertEquals("", indexState(CONTENT)); } + @Test + public void testRemoveCached() throws Exception { + File newFile = writeTrashFile("new.txt", "new"); + git.add().addFilepattern(newFile.getName()).call(); + assertEquals("[new.txt, mode:100644][test.txt, mode:100644]", + indexState(0)); + + git.rm().setCached(true).addFilepattern(newFile.getName()).call(); + + assertEquals("[test.txt, mode:100644]", indexState(0)); + assertTrue("File should not have been removed.", newFile.exists()); + } } |