Class BuiltinLFS

java.lang.Object
org.eclipse.jgit.util.LfsFactory
org.eclipse.jgit.lfs.BuiltinLFS

public class BuiltinLFS extends LfsFactory
Implementation of LfsFactory, using built-in (optional) LFS support.
Since:
4.11
  • Constructor Details

    • BuiltinLFS

      private BuiltinLFS()
  • Method Details

    • register

      public static void register()
      Activates the built-in LFS support.
    • isAvailable

      public boolean isAvailable()
      Overrides:
      isAvailable in class LfsFactory
      Returns:
      whether LFS support is available
    • applySmudgeFilter

      public ObjectLoader applySmudgeFilter(Repository db, ObjectLoader loader, Attribute attribute) throws IOException
      Description copied from class: LfsFactory
      Apply smudge filtering to a given loader, potentially redirecting it to a LFS blob which is downloaded on demand.
      Overrides:
      applySmudgeFilter in class LfsFactory
      Parameters:
      db - the repository
      loader - the loader for the blob
      attribute - the attribute used to check for LFS enablement (i.e. "merge", "diff", "filter" from .gitattributes).
      Returns:
      a loader for the actual data of a blob, or the original loader in case LFS is not applicable.
      Throws:
      IOException
    • applyCleanFilter

      public LfsFactory.LfsInputStream applyCleanFilter(Repository db, InputStream input, long length, Attribute attribute) throws IOException
      Description copied from class: LfsFactory
      Apply clean filtering to the given stream, writing the file content to the LFS storage if required and returning a stream to the LFS pointer instead.
      Overrides:
      applyCleanFilter in class LfsFactory
      Parameters:
      db - the repository
      input - the original input
      length - the expected input stream length
      attribute - the attribute used to check for LFS enablement (i.e. "merge", "diff", "filter" from .gitattributes).
      Returns:
      a stream to the content that should be written to the object store along with the expected length of the stream. the original stream is not applicable.
      Throws:
      IOException - in case of an error
    • getPrePushHook

      @Nullable public PrePushHook getPrePushHook(Repository repo, PrintStream outputStream)
      Description copied from class: LfsFactory
      Retrieve a pre-push hook to be applied using the default error stream.
      Overrides:
      getPrePushHook in class LfsFactory
      Parameters:
      repo - the Repository the hook is applied to.
      outputStream -
      Returns:
      a PrePushHook implementation or null
    • getPrePushHook

      @Nullable public PrePushHook getPrePushHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
      Description copied from class: LfsFactory
      Retrieve a pre-push hook to be applied.
      Overrides:
      getPrePushHook in class LfsFactory
      Parameters:
      repo - the Repository the hook is applied to.
      outputStream -
      errorStream -
      Returns:
      a PrePushHook implementation or null
    • isEnabled

      public boolean isEnabled(Repository db)
      Overrides:
      isEnabled in class LfsFactory
      Parameters:
      db - the repository
      Returns:
      whether LFS is requested for the given repo.
    • isEnabled

      private boolean isEnabled(Repository db, Attribute attribute)
      Parameters:
      db - the repository
      attribute - the attribute to check
      Returns:
      whether LFS filter is enabled for the given .gitattribute attribute.
    • getInstallCommand

      public LfsFactory.LfsInstallCommand getInstallCommand()
      Description copied from class: LfsFactory
      Retrieve an LfsFactory.LfsInstallCommand which can be used to enable LFS support (if available) either per repository or for the user.
      Overrides:
      getInstallCommand in class LfsFactory
      Returns:
      a command to install LFS support.