public class LfsFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LfsFactory.LfsInputStream
Encapsulate a potentially exchanged
InputStream along with the
expected stream content length. |
static interface |
LfsFactory.LfsInstallCommand
A command to enable LFS.
|
Modifier and Type | Field and Description |
---|---|
private static LfsFactory |
instance |
Modifier | Constructor and Description |
---|---|
protected |
LfsFactory()
Constructor
|
Modifier and Type | Method and Description |
---|---|
LfsFactory.LfsInputStream |
applyCleanFilter(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.
|
ObjectLoader |
applySmudgeFilter(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.
|
static Attributes |
getAttributesForPath(Repository db,
java.lang.String path) |
static Attributes |
getAttributesForPath(Repository db,
java.lang.String path,
RevCommit commit)
Get attributes for given path and commit
|
LfsFactory.LfsInstallCommand |
getInstallCommand()
Retrieve an
LfsFactory.LfsInstallCommand which can be used to enable LFS
support (if available) either per repository or for the user. |
static LfsFactory |
getInstance() |
PrePushHook |
getPrePushHook(Repository repo,
java.io.PrintStream outputStream)
Retrieve a pre-push hook to be applied using the default error stream.
|
PrePushHook |
getPrePushHook(Repository repo,
java.io.PrintStream outputStream,
java.io.PrintStream errorStream)
Retrieve a pre-push hook to be applied.
|
boolean |
isAvailable() |
boolean |
isEnabled(Repository db) |
static void |
setInstance(LfsFactory instance) |
private static LfsFactory instance
public static LfsFactory getInstance()
public static void setInstance(LfsFactory instance)
instance
- register a LfsFactory
instance as the
LfsFactory
implementation to use.public boolean isAvailable()
public LfsFactory.LfsInputStream applyCleanFilter(Repository db, java.io.InputStream input, long length, Attribute attribute) throws java.io.IOException
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).java.io.IOException
- in case of an errorpublic ObjectLoader applySmudgeFilter(Repository db, ObjectLoader loader, Attribute attribute) throws java.io.IOException
db
- the repositoryloader
- the loader for the blobattribute
- the attribute used to check for LFS enablement (i.e. "merge",
"diff", "filter" from .gitattributes).java.io.IOException
@Nullable public PrePushHook getPrePushHook(Repository repo, java.io.PrintStream outputStream)
repo
- the Repository
the hook is applied to.outputStream
- PrePushHook
implementation or null
@Nullable public PrePushHook getPrePushHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)
repo
- the Repository
the hook is applied to.outputStream
- errorStream
- PrePushHook
implementation or null
@Nullable public LfsFactory.LfsInstallCommand getInstallCommand()
LfsFactory.LfsInstallCommand
which can be used to enable LFS
support (if available) either per repository or for the user.public boolean isEnabled(Repository db)
db
- the repository to checkpublic static Attributes getAttributesForPath(Repository db, java.lang.String path) throws java.io.IOException
db
- the repositorypath
- the path to find attributes forAttributes
for the given path.java.io.IOException
- in case of an errorpublic static Attributes getAttributesForPath(Repository db, java.lang.String path, RevCommit commit) throws java.io.IOException
db
- the repositorypath
- the path to find attributes forcommit
- the commit to inspect.Attributes
for the given path.java.io.IOException
- in case of an error