Class Lfs


  • public class Lfs
    extends Object
    Class which represents the lfs folder hierarchy inside a .git folder
    Since:
    4.6
    • Constructor Detail

      • Lfs

        public Lfs​(Repository db)
        Constructor for Lfs.
        Parameters:
        db - the associated repo
        Since:
        4.11
    • Method Detail

      • getLfsRoot

        public Path getLfsRoot()
        Get the LFS root directory
        Returns:
        the path to the LFS directory
      • getLfsTmpDir

        public Path getLfsTmpDir()
        Get the path to the temporary directory used by LFS.
        Returns:
        the path to the temporary directory used by LFS. Will be <repo>/.git/lfs/tmp
      • getLfsObjDir

        public Path getLfsObjDir()
        Get the object directory used by LFS
        Returns:
        the path to the object directory used by LFS. Will be <repo>/.git/lfs/objects
      • getMediaFile

        public Path getMediaFile​(AnyLongObjectId id)
        Get the media file which stores the original content
        Parameters:
        id - the id of the mediafile
        Returns:
        the file which stores the original content. Its path will look like "<repo>/.git/lfs/objects/<firstTwoLettersOfID>/<remainingLettersOfID>"
      • createTmpFile

        public Path createTmpFile()
                           throws IOException
        Create a new temp file in the LFS directory
        Returns:
        a new temporary file in the LFS directory
        Throws:
        IOException - when the temp file could not be created