Browse Source
Some applications using JGit use their own repository caching. In such applications, it may be needlessly inefficient to create new submodule repositories from a SubmoduleWalk or in an IndexDiff. It can be much more efficient to use an already cached repository instance. Provide a way to configure a SubmoduleWalk with a factory to create BaseRepositoryBuilders to use to create repositories, and use it in IndexDiff. Provide new IndexDiff.diff() operations that take such an additional factory as parameter. An application that caches Repository instances (for instance EGit) can use a factory that provides builders that don't create a new Repository instance but that return the already cached instance, if one is available. Note that in such a case, the application may need to be prepared to deal with IndexDiff.diff() also _closing_ the obtained repository; if the application expects its cached Repository instances to remain open while being cached, it'll have to use Repository.incrementOpen() to prevent that the repository instance gets closed. Bug: 550878 Change-Id: Icc1b34dfc4cebd8ed4739dd09d37744d41adf711 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>next
Thomas Wolf
5 years ago
committed by
Matthias Sohn
3 changed files with 149 additions and 8 deletions
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2019, Thomas Wolf <thomas.wolf@paranor.ch> and others |
||||||
|
* |
||||||
|
* This program and the accompanying materials are made available under the |
||||||
|
* terms of the Eclipse Distribution License v. 1.0 which is available at |
||||||
|
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||||
|
* |
||||||
|
* SPDX-License-Identifier: BSD-3-Clause |
||||||
|
*/ |
||||||
|
package org.eclipse.jgit.lib; |
||||||
|
|
||||||
|
import java.util.function.Supplier; |
||||||
|
|
||||||
|
/** |
||||||
|
* A factory for {@link BaseRepositoryBuilder}s. |
||||||
|
* <p> |
||||||
|
* Note that a {@link BaseRepositoryBuilder} should be used only once to build a |
||||||
|
* repository. Otherwise subsequently built repositories may be built using |
||||||
|
* settings made for earlier built repositories. |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @since 5.6 |
||||||
|
*/ |
||||||
|
public interface RepositoryBuilderFactory extends |
||||||
|
Supplier<BaseRepositoryBuilder<? extends BaseRepositoryBuilder, ? extends Repository>> { |
||||||
|
// Empty
|
||||||
|
} |
Loading…
Reference in new issue