public class LfsFactory extends 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 | Constructor and Description |
---|---|
protected |
LfsFactory()
Constructor
|
Modifier and Type | Method and Description |
---|---|
LfsFactory.LfsInputStream |
applyCleanFilter(Repository db,
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,
String path) |
static Attributes |
getAttributesForPath(Repository db,
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,
PrintStream outputStream)
Retrieve a pre-push hook to be applied.
|
boolean |
isAvailable() |
boolean |
isEnabled(Repository db) |
static void |
setInstance(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, InputStream input, long length, Attribute attribute) throws 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).IOException
- in case of an errorpublic ObjectLoader applySmudgeFilter(Repository db, ObjectLoader loader, Attribute attribute) throws IOException
db
- the repositoryloader
- the loader for the blobattribute
- the attribute used to check for LFS enablement (i.e. "merge",
"diff", "filter" from .gitattributes).IOException
@Nullable public PrePushHook getPrePushHook(Repository repo, PrintStream outputStream)
repo
- the Repository
the hook is applied to.outputStream
- 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, String path) throws IOException
db
- the repositorypath
- the path to find attributes forAttributes
for the given path.IOException
- in case of an errorpublic static Attributes getAttributesForPath(Repository db, String path, RevCommit commit) throws IOException
db
- the repositorypath
- the path to find attributes forcommit
- the commit to inspect.Attributes
for the given path.IOException
- in case of an errorCopyright © 2019 Eclipse JGit Project. All rights reserved.