summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2012-10-07 17:13:18 +0200
committerRobin Stocker <robin@nibor.org>2012-10-08 00:31:26 +0200
commitc96b40d5921d68edb96afad38b9c171388af4e05 (patch)
tree2d5e915466da59425d8d1ca3856d00f0005dc596 /org.eclipse.jgit.test
parent6da9473fe363c6419d35f5d0af49fef98ad1a0bc (diff)
downloadjgit-c96b40d5921d68edb96afad38b9c171388af4e05.tar.gz
jgit-c96b40d5921d68edb96afad38b9c171388af4e05.zip
CommitCommand: Don't allow amending on initial commit
Change-Id: I27b13510eb6756da21d0d359d76031da4a875e28
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
index 44f1a48c31..3729387f32 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
@@ -50,6 +50,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.List;
+import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.lib.ConfigConstants;
@@ -420,4 +421,10 @@ public class CommitCommandTest extends RepositoryTestCase {
assertEquals("commit: Squashed commit of the following:", db
.getReflogReader(db.getBranch()).getLastEntry().getComment());
}
+
+ @Test(expected = WrongRepositoryStateException.class)
+ public void commitAmendOnInitialShouldFail() throws Exception {
+ Git git = new Git(db);
+ git.commit().setAmend(true).setMessage("initial commit").call();
+ }
}