View Javadoc
1   /*
2    * Copyright (C) 2019, Google LLC and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.internal.revwalk;
11  
12  import static org.junit.Assert.assertNotNull;
13  
14  import org.eclipse.jgit.internal.storage.file.FileRepository;
15  import org.eclipse.jgit.internal.storage.file.GC;
16  import org.eclipse.jgit.junit.TestRepository;
17  import org.eclipse.jgit.revwalk.ReachabilityChecker;
18  
19  public class BitmappedReachabilityCheckerTest
20  		extends ReachabilityCheckerTestCase {
21  
22  	@Override
23  	protected ReachabilityChecker getChecker(
24  			TestRepository<FileRepository> repository) throws Exception {
25  		// GC generates the bitmaps
26  		GC gc = new GC(repo.getRepository());
27  		gc.setAuto(false);
28  		gc.gc().get();
29  
30  		// This is null when the test didn't create any branch
31  		assertNotNull("Probably the test didn't define any ref",
32  				repo.getRevWalk().getObjectReader().getBitmapIndex());
33  
34  		return new BitmappedReachabilityChecker(repository.getRevWalk());
35  	}
36  
37  }