@ -226,6 +226,44 @@ public class UploadPackTest {
}
}
}
}
@Test
public void testFetchExplicitBlobWithFilter ( ) throws Exception {
InMemoryRepository server2 = newRepo ( "server2" ) ;
TestRepository < InMemoryRepository > remote2 =
new TestRepository < > ( server2 ) ;
RevBlob blob1 = remote2 . blob ( "foobar" ) ;
RevBlob blob2 = remote2 . blob ( "fooba" ) ;
RevTree tree = remote2 . tree ( remote2 . file ( "1" , blob1 ) ,
remote2 . file ( "2" , blob2 ) ) ;
RevCommit commit = remote2 . commit ( tree ) ;
remote2 . update ( "master" , commit ) ;
remote2 . update ( "a_blob" , blob1 ) ;
server2 . getConfig ( ) . setBoolean ( "uploadpack" , null , "allowfilter" , true ) ;
testProtocol = new TestProtocol < > (
new UploadPackFactory < Object > ( ) {
@Override
public UploadPack create ( Object req , Repository db )
throws ServiceNotEnabledException ,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack ( db ) ;
return up ;
}
} , null ) ;
uri = testProtocol . register ( ctx , server2 ) ;
try ( Transport tn = testProtocol . open ( uri , client , "server2" ) ) {
tn . setFilterBlobLimit ( 0 ) ;
tn . fetch ( NullProgressMonitor . INSTANCE , Arrays . asList (
new RefSpec ( commit . name ( ) ) ,
new RefSpec ( blob1 . name ( ) ) ) ) ;
assertTrue ( client . hasObject ( tree . toObjectId ( ) ) ) ;
assertTrue ( client . hasObject ( blob1 . toObjectId ( ) ) ) ;
assertFalse ( client . hasObject ( blob2 . toObjectId ( ) ) ) ;
}
}
@Test
@Test
public void testFetchWithBlobLimitFilter ( ) throws Exception {
public void testFetchWithBlobLimitFilter ( ) throws Exception {
InMemoryRepository server2 = newRepo ( "server2" ) ;
InMemoryRepository server2 = newRepo ( "server2" ) ;
@ -261,6 +299,47 @@ public class UploadPackTest {
}
}
}
}
@Test
public void testFetchExplicitBlobWithFilterAndBitmaps ( ) throws Exception {
InMemoryRepository server2 = newRepo ( "server2" ) ;
TestRepository < InMemoryRepository > remote2 =
new TestRepository < > ( server2 ) ;
RevBlob blob1 = remote2 . blob ( "foobar" ) ;
RevBlob blob2 = remote2 . blob ( "fooba" ) ;
RevTree tree = remote2 . tree ( remote2 . file ( "1" , blob1 ) ,
remote2 . file ( "2" , blob2 ) ) ;
RevCommit commit = remote2 . commit ( tree ) ;
remote2 . update ( "master" , commit ) ;
remote2 . update ( "a_blob" , blob1 ) ;
server2 . getConfig ( ) . setBoolean ( "uploadpack" , null , "allowfilter" , true ) ;
// generate bitmaps
new DfsGarbageCollector ( server2 ) . pack ( null ) ;
server2 . scanForRepoChanges ( ) ;
testProtocol = new TestProtocol < > (
new UploadPackFactory < Object > ( ) {
@Override
public UploadPack create ( Object req , Repository db )
throws ServiceNotEnabledException ,
ServiceNotAuthorizedException {
UploadPack up = new UploadPack ( db ) ;
return up ;
}
} , null ) ;
uri = testProtocol . register ( ctx , server2 ) ;
try ( Transport tn = testProtocol . open ( uri , client , "server2" ) ) {
tn . setFilterBlobLimit ( 0 ) ;
tn . fetch ( NullProgressMonitor . INSTANCE , Arrays . asList (
new RefSpec ( commit . name ( ) ) ,
new RefSpec ( blob1 . name ( ) ) ) ) ;
assertTrue ( client . hasObject ( blob1 . toObjectId ( ) ) ) ;
assertFalse ( client . hasObject ( blob2 . toObjectId ( ) ) ) ;
}
}
@Test
@Test
public void testFetchWithBlobLimitFilterAndBitmaps ( ) throws Exception {
public void testFetchWithBlobLimitFilterAndBitmaps ( ) throws Exception {
InMemoryRepository server2 = newRepo ( "server2" ) ;
InMemoryRepository server2 = newRepo ( "server2" ) ;