Class FileModeCache


  • public class FileModeCache
    extends java.lang.Object
    A hierarchical cache of FileModes per git path.
    Since:
    6.6.1
    • Method Detail

      • safeCreateParentDirectory

        public void safeCreateParentDirectory​(java.lang.String gitPath,
                                              java.io.File parentDir,
                                              boolean makeSpace)
                                       throws java.io.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 written
        parentDir - directory in which the file shall be placed, assumed to be the parent of the gitPath
        makeSpace - whether to delete a possibly existing file at parentDir
        Throws:
        java.io.IOException - if the directory cannot be created, if necessary
      • safeCreateDirectory

        public FileModeCache.CacheItem safeCreateDirectory​(java.lang.String gitPath,
                                                           java.io.File dir,
                                                           boolean makeSpace)
                                                    throws java.io.IOException
        Ensures the given directory dir with the given git path exists.
        Parameters:
        gitPath - of a file to be written
        dir - directory in which the file shall be placed, assumed to be the parent of the gitPath
        makeSpace - whether to remove a file that already at that name
        Returns:
        A FileModeCache.CacheItem describing the directory, which is guaranteed to exist
        Throws:
        java.io.IOException - if the directory cannot be made to exist at the given location
      • deleteSymlinkParent

        private void deleteSymlinkParent​(FS fs,
                                         java.lang.String gitPath,
                                         java.io.File workingTree)
                                  throws java.io.IOException
        Throws:
        java.io.IOException