summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server.test/tst
diff options
context:
space:
mode:
authorMarkus Duft <markus.duft@ssi-schaefer.com>2017-12-05 11:16:30 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2018-03-03 11:44:01 +0100
commitc0103bc59d5b4a539f01bc9c98610ab3f11be114 (patch)
tree8a1026680532ec1351f3728a340d4ed613a6f826 /org.eclipse.jgit.lfs.server.test/tst
parenta3f8edbf6a915ab965039df02abf94b4cca891a5 (diff)
downloadjgit-c0103bc59d5b4a539f01bc9c98610ab3f11be114.tar.gz
jgit-c0103bc59d5b4a539f01bc9c98610ab3f11be114.zip
LFS: Enable LFS support for the CLI, better error handling
Enable LFS support for the CLI by registering the according filters. Errors during filter creation must be propagated up the call stack, as a failure to create a filter should be treated as fatal if the filter is required. Change-Id: I3833757839bdda97cd01b6c21c1613d199e2692d Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server.test/tst')
-rw-r--r--org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/CheckoutTest.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/CheckoutTest.java b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/CheckoutTest.java
index df43ccf41b..67c8bd267c 100644
--- a/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/CheckoutTest.java
+++ b/org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/CheckoutTest.java
@@ -49,10 +49,13 @@ import java.nio.file.Files;
import java.nio.file.Path;
import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.junit.JGitTestUtil;
import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lfs.BuiltinLFS;
+import org.eclipse.jgit.lfs.lib.Constants;
import org.eclipse.jgit.lfs.lib.LongObjectId;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
@@ -78,8 +81,12 @@ public class CheckoutTest extends LfsServerTest {
.create(tmp.resolve(".git").toFile());
db.create();
StoredConfig cfg = db.getConfig();
- cfg.setString("filter", "lfs", "usejgitbuiltin", "true");
- cfg.setString("lfs", null, "url", server.getURI().toString() + "/lfs");
+ cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS,
+ ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true);
+ cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS,
+ ConfigConstants.CONFIG_KEY_REQUIRED, false);
+ cfg.setString(Constants.LFS, null, "url",
+ server.getURI().toString() + "/lfs");
cfg.save();
tdb = new TestRepository<>(db);
@@ -112,6 +119,17 @@ public class CheckoutTest extends LfsServerTest {
server.getRequests().toString());
}
+ @Test(expected = JGitInternalException.class)
+ public void testUnknownContentRequired() throws Exception {
+ StoredConfig cfg = tdb.getRepository().getConfig();
+ cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, Constants.LFS,
+ ConfigConstants.CONFIG_KEY_REQUIRED, true);
+ cfg.save();
+
+ // must throw
+ git.checkout().setName("test").call();
+ }
+
@Test
public void testKnownContent() throws Exception {
putContent(