This class is thread-safe.
This implementation only handles a subtly undocumented subset of git features.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | FileRepository.
Implementation a |
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private final ObjectDirectory | |
| private RefDatabase | |
| private final FileBasedConfig | |
| private FileSnapshot | |
| private final Object | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | FileRepository(File
GIT_DIR (the location of the repository metadata). gitDir)Construct a representation of a Git repository. |
| public | FileRepository(String
GIT_DIR (the location of the repository metadata). gitDir)A convenience API for |
| public | FileRepository(BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Repository>
description of the repository's important paths. options)Create a repository using the local file system. |
| Modifier and Type | Method and Description |
|---|---|
| public void | autoGC(ProgressMonitor
to report progress monitor)Overrides org. Check whether any housekeeping is required; if yes, run garbage collection; if not, exit without performing any work. |
| public void | convertRefStorage(String
the format to convert to, either "reftable" or "refdir" format, boolean whether to write reflogs writeLogs, boolean whether to make a backup of the old data backup)Converts between ref storage formats. |
| pack-priv void | convertToPackedRefs(boolean
whether to write reflogs writeLogs, boolean whether to rename or delete the old storage files. If set to
backup)true, the reftable list is left in refs.old,
and the reftable/ dir is left alone. If set to
false, the reftable/ dir is removed, and
refs file is removed.Converts the RefDatabase from reftable to RefDirectory. |
| pack-priv void | convertToReftable(boolean
whether to write reflogs writeLogs, boolean whether to rename or delete the old storage files. If set to
backup)true, the loose refs are left in refs.old, the
packed-refs in packed-refs.old and reflogs in
refs.old/. HEAD is left in HEAD.old and also
.log is appended to additional refs. If set to
false, the refs/ and logs/ directories
and HEAD and additional symbolic refs are removed.Converts the RefDatabase from RefDirectory to reftable. |
| public void | create(boolean
if true, a bare repository (a repository without a working
directory) is created. bare)Implements abstract org. Create a new Git repository initializing the necessary files and directories. |
| public void | create(boolean
if true, a bare repository (a repository without a working
directory) is created. bare, boolean if true, relative paths are used for GIT_DIR and GIT_WORK_TREE relativePaths)Create a new Git repository initializing the necessary files and directories. |
| public AttributesNodeProvider | createAttributesNodeProvider()
Implements abstract org. Create a new |
| private File | |
| private void | |
| public Set | getAdditionalHaves()
Overrides org. Objects known to exist but not expressed by |
| private Set | Returns: unmodifiable collection of other known objects.Set of AlternateHandle Ids already seen skipsObjects known to exist but not expressed by |
| public FileBasedConfig | getConfig()
Implements abstract org. Get the configuration of this repository. |
| public String | getGitwebDescription()
Overrides org. Read the |
| public String | getIdentifier()
Implements abstract org. Get repository identifier. |
| public ObjectDirectory | getObjectDatabase()
Implements abstract org. Get the object database which stores this repository's data. |
| public File | Returns: the directory containing the objects owned by this repository.Get the directory containing the objects owned by this repository |
| public RefDatabase | getRefDatabase()
Implements abstract org. Get the reference database which stores the reference namespace. |
| private String | |
| private void | |
| public void | notifyIndexChanged(boolean
true if the index was changed by the same
JGit processImplements abstract org. Notify that the index changed by firing an IndexChangedEvent. |
| public void | |
| public void | scanForRepoChanges()
Implements abstract org. Force a scan for changed refs. |
| public void | setGitwebDescription(String
new description; null to clear the description. description)Overrides org. Set the |
| private boolean |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| objectDatabase | back to summary |
|---|---|
| private final ObjectDirectory objectDatabase | |
| refs | back to summary |
|---|---|
| private RefDatabase refs | |
| repoConfig | back to summary |
|---|---|
| private final FileBasedConfig repoConfig | |
| snapshot | back to summary |
|---|---|
| private FileSnapshot snapshot | |
| snapshotLock | back to summary |
|---|---|
| private final Object snapshotLock | |
| UNNAMED | back to summary |
|---|---|
| private static final String UNNAMED | |
| FileRepository | back to summary |
|---|---|
| public FileRepository(File gitDir) throws IOException Construct a representation of a Git repository.
The work tree, object directory, alternate object directories and index
file locations are deduced from the given git directory and the default
rules by running
new FileRepositoryBuilder().setGitDir(gitDir).build()
| |
| FileRepository | back to summary |
|---|---|
| public FileRepository(String gitDir) throws IOException A convenience API for
| |
| FileRepository | back to summary |
|---|---|
| public FileRepository(BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Repository> options) throws IOException Create a repository using the local file system.
| |
| autoGC | back to summary |
|---|---|
| public void autoGC(ProgressMonitor monitor) Overrides org. Doc from org. Check whether any housekeeping is required; if yes, run garbage collection; if not, exit without performing any work. Some JGit commands run autoGC after performing operations that could create many loose objects.
Currently this option is supported for repositories of type
| |
| convertRefStorage | back to summary |
|---|---|
| public void convertRefStorage(String format, boolean writeLogs, boolean backup) throws IOException Converts between ref storage formats.
| |
| convertToPackedRefs | back to summary |
|---|---|
| pack-priv void convertToPackedRefs(boolean writeLogs, boolean backup) throws IOException Converts the RefDatabase from reftable to RefDirectory. This operation is not atomic.
| |
| convertToReftable | back to summary |
|---|---|
| pack-priv void convertToReftable(boolean writeLogs, boolean backup) throws IOException Converts the RefDatabase from RefDirectory to reftable. This operation is not atomic.
| |
| create | back to summary |
|---|---|
| public void create(boolean bare) throws IOException Implements abstract org. Doc from org. Create a new Git repository initializing the necessary files and directories. Create a new Git repository initializing the necessary files and directories.
| |
| create | back to summary |
|---|---|
| public void create(boolean bare, boolean relativePaths) throws IOException Create a new Git repository initializing the necessary files and directories.
| |
| createAttributesNodeProvider | back to summary |
|---|---|
| public AttributesNodeProvider createAttributesNodeProvider() Implements abstract org. Doc from org. Create a new
| |
| descriptionFile | back to summary |
|---|---|
| private File descriptionFile() | |
| detectIndexChanges | back to summary |
|---|---|
| private void detectIndexChanges() Detect index changes. | |
| getAdditionalHaves | back to summary |
|---|---|
| public Set Overrides org. Doc from org. Objects known to exist but not expressed by When a repository borrows objects from another repository, it can advertise that it safely has that other repository's references, without exposing any other details about the other repository. This may help a client trying to push changes avoid pushing more than it needs to.
Objects known to exist but not expressed by When a repository borrows objects from another repository, it can advertise that it safely has that other repository's references, without exposing any other details about the other repository. This may help a client trying to push changes avoid pushing more than it needs to.
| |
| getAdditionalHaves | back to summary |
|---|---|
| private Set Objects known to exist but not expressed by When a repository borrows objects from another repository, it can advertise that it safely has that other repository's references, without exposing any other details about the other repository. This may help a client trying to push changes avoid pushing more than it needs to.
| |
| getConfig | back to summary |
|---|---|
| public FileBasedConfig getConfig() Implements abstract org. Doc from org. Get the configuration of this repository.
| |
| getGitwebDescription | back to summary |
|---|---|
| public String getGitwebDescription() throws IOException Overrides org. Doc from org. Read the
| |
| getIdentifier | back to summary |
|---|---|
| public String getIdentifier() Implements abstract org. Doc from org. Get repository identifier. | |
| getObjectDatabase | back to summary |
|---|---|
| public ObjectDirectory getObjectDatabase() Implements abstract org. Doc from org. Get the object database which stores this repository's data.
| |
| getObjectsDirectory | back to summary |
|---|---|
| public File getObjectsDirectory() Get the directory containing the objects owned by this repository
| |
| getRefDatabase | back to summary |
|---|---|
| public RefDatabase getRefDatabase() Implements abstract org. Doc from org. Get the reference database which stores the reference namespace.
| |
| getRelativeDir | back to summary |
|---|---|
| private String getRelativeDir(File base, File other) | |
| loadRepoConfig | back to summary |
|---|---|
| private void loadRepoConfig() throws IOException | |
| notifyIndexChanged | back to summary |
|---|---|
| public void notifyIndexChanged(boolean internal) Implements abstract org. Doc from org. Notify that the index changed by firing an IndexChangedEvent.
| |
| openPack | back to summary |
|---|---|
| public void openPack(File pack) throws IOException Add a single existing pack to the list of available pack files.
| |
| scanForRepoChanges | back to summary |
|---|---|
| public void scanForRepoChanges() throws IOException Implements abstract org. Doc from org. Force a scan for changed refs. Fires an IndexChangedEvent(false) if changes are detected.
| |
| setGitwebDescription | back to summary |
|---|---|
| public void setGitwebDescription(String description) throws IOException Overrides org. Doc from org. Set the
| |
| shouldAutoDetach | back to summary |
|---|---|
| private boolean shouldAutoDetach() | |
AttributesNodeProvider for a
FileRepository.
| Modifier and Type | Field and Description |
|---|---|
| private AttributesNode | |
| private AttributesNode |
| Access | Constructor and Description |
|---|---|
| protected | AttributesNodeProviderImpl(Repository
Repository that will provide the attribute nodes.Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public AttributesNode | getGlobalAttributesNode()
Implements org. Retrieve the |
| public AttributesNode | getInfoAttributesNode()
Implements org. Retrieve the |
| pack-priv static void |
| globalAttributesNode | back to summary |
|---|---|
| private AttributesNode globalAttributesNode | |
| infoAttributesNode | back to summary |
|---|---|
| private AttributesNode infoAttributesNode | |
| AttributesNodeProviderImpl | back to summary |
|---|---|
| protected AttributesNodeProviderImpl(Repository repo) Constructor.
| |
| getGlobalAttributesNode | back to summary |
|---|---|
| public AttributesNode getGlobalAttributesNode() throws IOException Implements org. Doc from org. Retrieve the
| |
| getInfoAttributesNode | back to summary |
|---|---|
| public AttributesNode getInfoAttributesNode() throws IOException Implements org. Doc from org. Retrieve the
| |
| loadRulesFromFile | back to summary |
|---|---|
| pack-priv static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException | |