- java.lang.Object
-
- org.eclipse.jgit.lib.FileModeCache
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileModeCache.CacheItemAn item from aFileModeCache, recording information about a git path (known from context).
-
Constructor Summary
Constructors Constructor Description FileModeCache(Repository repo)Creates a newFileModeCachefor aRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RepositorygetRepository()Retrieves theRepository.FileModeCache.CacheItemgetRoot()Obtains theFileModeCache.CacheItemfor the working tree root.FileModeCache.CacheItemsafeCreateDirectory(String gitPath, File dir, boolean makeSpace)Ensures the given directorydirwith the given git path exists.voidsafeCreateParentDirectory(String gitPath, File parentDir, boolean makeSpace)Ensure that the given parent directory exists, and cache the information that gitPath refers to a file.
-
-
-
Constructor Detail
-
FileModeCache
public FileModeCache(@NonNull Repository repo)
Creates a newFileModeCachefor aRepository.- Parameters:
repo-Repositorythis cache is for
-
-
Method Detail
-
getRepository
@NonNull public Repository getRepository()
Retrieves theRepository.- Returns:
- the
RepositorythisFileModeCachewas created for
-
getRoot
@NonNull public FileModeCache.CacheItem getRoot()
Obtains theFileModeCache.CacheItemfor the working tree root.- Returns:
- the
FileModeCache.CacheItem
-
safeCreateParentDirectory
public void safeCreateParentDirectory(String gitPath, File parentDir, boolean makeSpace) throws IOException
Ensure that the given parent directory exists, and cache the information that gitPath refers to a file.- Parameters:
gitPath- of the file to be writtenparentDir- directory in which the file shall be placed, assumed to be the parent of thegitPathmakeSpace- whether to delete a possibly existing file atparentDir- Throws:
IOException- if the directory cannot be created, if necessary
-
safeCreateDirectory
public FileModeCache.CacheItem safeCreateDirectory(String gitPath, File dir, boolean makeSpace) throws IOException
Ensures the given directorydirwith the given git path exists.- Parameters:
gitPath- of a file to be writtendir- directory in which the file shall be placed, assumed to be the parent of thegitPathmakeSpace- whether to remove a file that already at that name- Returns:
- A
FileModeCache.CacheItemdescribing the directory, which is guaranteed to exist - Throws:
IOException- if the directory cannot be made to exist at the given location
-
-