Package org.eclipse.jgit.lfs
Class BuiltinLFS
- java.lang.Object
-
- org.eclipse.jgit.util.LfsFactory
-
- org.eclipse.jgit.lfs.BuiltinLFS
-
public class BuiltinLFS extends LfsFactory
Implementation ofLfsFactory, using built-in (optional) LFS support.- Since:
- 4.11
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.util.LfsFactory
LfsFactory.LfsInputStream, LfsFactory.LfsInstallCommand
-
-
Constructor Summary
Constructors Modifier Constructor Description privateBuiltinLFS()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LfsFactory.LfsInputStreamapplyCleanFilter(Repository db, java.io.InputStream input, long length, Attribute attribute)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.ObjectLoaderapplySmudgeFilter(Repository db, ObjectLoader loader, Attribute attribute)Apply smudge filtering to a given loader, potentially redirecting it to a LFS blob which is downloaded on demand.LfsFactory.LfsInstallCommandgetInstallCommand()Retrieve anLfsFactory.LfsInstallCommandwhich can be used to enable LFS support (if available) either per repository or for the user.PrePushHookgetPrePushHook(Repository repo, java.io.PrintStream outputStream)Retrieve a pre-push hook to be applied using the default error stream.PrePushHookgetPrePushHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)Retrieve a pre-push hook to be applied.booleanisAvailable()booleanisEnabled(Repository db)private booleanisEnabled(Repository db, Attribute attribute)static voidregister()Activates the built-in LFS support.-
Methods inherited from class org.eclipse.jgit.util.LfsFactory
getAttributesForPath, getAttributesForPath, getInstance, setInstance
-
-
-
-
Method Detail
-
register
public static void register()
Activates the built-in LFS support.
-
isAvailable
public boolean isAvailable()
- Overrides:
isAvailablein classLfsFactory- Returns:
- whether LFS support is available
-
applySmudgeFilter
public ObjectLoader applySmudgeFilter(Repository db, ObjectLoader loader, Attribute attribute) throws java.io.IOException
Description copied from class:LfsFactoryApply smudge filtering to a given loader, potentially redirecting it to a LFS blob which is downloaded on demand.- Overrides:
applySmudgeFilterin classLfsFactory- Parameters:
db- the repositoryloader- the loader for the blobattribute- 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:
java.io.IOException
-
applyCleanFilter
public LfsFactory.LfsInputStream applyCleanFilter(Repository db, java.io.InputStream input, long length, Attribute attribute) throws java.io.IOException
Description copied from class:LfsFactoryApply 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:
applyCleanFilterin classLfsFactory- Parameters:
db- the repositoryinput- the original inputlength- the expected input stream lengthattribute- 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:
java.io.IOException- in case of an error
-
getPrePushHook
@Nullable public PrePushHook getPrePushHook(Repository repo, java.io.PrintStream outputStream)
Description copied from class:LfsFactoryRetrieve a pre-push hook to be applied using the default error stream.- Overrides:
getPrePushHookin classLfsFactory- Parameters:
repo- theRepositorythe hook is applied to.- Returns:
- a
PrePushHookimplementation ornull
-
getPrePushHook
@Nullable public PrePushHook getPrePushHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)
Description copied from class:LfsFactoryRetrieve a pre-push hook to be applied.- Overrides:
getPrePushHookin classLfsFactory- Parameters:
repo- theRepositorythe hook is applied to.- Returns:
- a
PrePushHookimplementation ornull
-
isEnabled
public boolean isEnabled(Repository db)
- Overrides:
isEnabledin classLfsFactory- Parameters:
db- the repository- Returns:
- whether LFS is requested for the given repo.
-
isEnabled
private boolean isEnabled(Repository db, Attribute attribute)
- Parameters:
db- the repositoryattribute- the attribute to check- Returns:
- whether LFS filter is enabled for the given .gitattribute attribute.
-
getInstallCommand
public LfsFactory.LfsInstallCommand getInstallCommand()
Description copied from class:LfsFactoryRetrieve anLfsFactory.LfsInstallCommandwhich can be used to enable LFS support (if available) either per repository or for the user.- Overrides:
getInstallCommandin classLfsFactory- Returns:
- a command to install LFS support.
-
-