Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java
index dae477928b..8cdd45ac7b 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ResetTest.java
@@ -48,6 +48,7 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
public class ResetTest extends CLIRepositoryTestCase {
@@ -62,6 +63,13 @@ public class ResetTest extends CLIRepositoryTestCase {
}
@Test
+ public void testZombieArgument_Bug484951() throws Exception {
+ String[] result = execute("git reset -h");
+ assertFalse("Unexpected argument: " + result[0],
+ result[0].contains("[VAL ...]"));
+ }
+
+ @Test
public void testResetSelf() throws Exception {
RevCommit commit = git.commit().setMessage("initial commit").call();
assertStringArrayEquals("",
@@ -91,15 +99,28 @@ public class ResetTest extends CLIRepositoryTestCase {
@Test
public void testResetPathDoubleDash() throws Exception {
- resetPath(true);
+ resetPath(true, true);
}
@Test
public void testResetPathNoDoubleDash() throws Exception {
- resetPath(false);
+ resetPath(false, true);
+ }
+
+ @Test
+ public void testResetPathDoubleDashNoRef() throws Exception {
+ resetPath(true, false);
+ }
+
+ @Ignore("Currently we cannote recognize if a name is a commit-ish or a path, "
+ + "so 'git reset a' will not work if 'a' is not a branch name but a file path")
+ @Test
+ public void testResetPathNoDoubleDashNoRef() throws Exception {
+ resetPath(false, false);
}
- private void resetPath(boolean useDoubleDash) throws Exception {
+ private void resetPath(boolean useDoubleDash, boolean supplyCommit)
+ throws Exception {
// create files a and b
writeTrashFile("a", "Hello world a");
writeTrashFile("b", "Hello world b");
@@ -115,8 +136,9 @@ public class ResetTest extends CLIRepositoryTestCase {
git.add().addFilepattern(".").call();
// reset only file a
- String cmd = String.format("git reset %s%s a", commit.getId().name(),
- (useDoubleDash) ? " --" : "");
+ String cmd = String.format("git reset %s%s a",
+ supplyCommit ? commit.getId().name() : "",
+ useDoubleDash ? " --" : "");
assertStringArrayEquals("", execute(cmd));
assertEquals(commit.getId(),
git.getRepository().exactRef("HEAD").getObjectId());

Back to the top