@ -49,10 +49,13 @@ import java.nio.file.Files;
import java.nio.file.Path ;
import java.nio.file.Path ;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.errors.JGitInternalException ;
import org.eclipse.jgit.junit.JGitTestUtil ;
import org.eclipse.jgit.junit.JGitTestUtil ;
import org.eclipse.jgit.junit.TestRepository ;
import org.eclipse.jgit.junit.TestRepository ;
import org.eclipse.jgit.lfs.BuiltinLFS ;
import org.eclipse.jgit.lfs.BuiltinLFS ;
import org.eclipse.jgit.lfs.lib.Constants ;
import org.eclipse.jgit.lfs.lib.LongObjectId ;
import org.eclipse.jgit.lfs.lib.LongObjectId ;
import org.eclipse.jgit.lib.ConfigConstants ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.lib.StoredConfig ;
import org.eclipse.jgit.lib.StoredConfig ;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder ;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder ;
@ -78,8 +81,12 @@ public class CheckoutTest extends LfsServerTest {
. create ( tmp . resolve ( ".git" ) . toFile ( ) ) ;
. create ( tmp . resolve ( ".git" ) . toFile ( ) ) ;
db . create ( ) ;
db . create ( ) ;
StoredConfig cfg = db . getConfig ( ) ;
StoredConfig cfg = db . getConfig ( ) ;
cfg . setString ( "filter" , "lfs" , "usejgitbuiltin" , "true" ) ;
cfg . setBoolean ( ConfigConstants . CONFIG_FILTER_SECTION , Constants . LFS ,
cfg . setString ( "lfs" , null , "url" , server . getURI ( ) . toString ( ) + "/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 ( ) ;
cfg . save ( ) ;
tdb = new TestRepository < > ( db ) ;
tdb = new TestRepository < > ( db ) ;
@ -112,6 +119,17 @@ public class CheckoutTest extends LfsServerTest {
server . getRequests ( ) . toString ( ) ) ;
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
@Test
public void testKnownContent ( ) throws Exception {
public void testKnownContent ( ) throws Exception {
putContent (
putContent (