Package org.eclipse.jgit.lfs
Class SmudgeFilter
java.lang.Object
org.eclipse.jgit.attributes.FilterCommand
org.eclipse.jgit.lfs.SmudgeFilter
Built-in LFS smudge filter
When content is read from git's object-database and written to the filesystem
and this filter is configured for that content, then this filter will replace
the content of LFS pointer files with the original content. This happens e.g.
when a checkout needs to update a working tree file which is under LFS
control.
- Since:
- 4.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FilterCommandFactoryThe factory is responsible for creating instances ofSmudgeFilterprivate static final intMax number of bytes to copy in a singlerun()call.Fields inherited from class org.eclipse.jgit.attributes.FilterCommand
in, out -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSmudgeFilter(InputStream in, OutputStream out, Repository db) SmudgeFilter(Repository db, InputStream in, OutputStream out) Constructor for SmudgeFilter. -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Path>downloadLfsResource(Lfs lfs, Repository db, LfsPointer... res) Download content which is hosted on a LFS server(package private) static voidregister()Register this filter in JGitintrun()Execute the command.
-
Field Details
-
MAX_COPY_BYTES
private static final int MAX_COPY_BYTESMax number of bytes to copy in a singlerun()call.- See Also:
-
FACTORY
The factory is responsible for creating instances ofSmudgeFilter
-
-
Constructor Details
-
SmudgeFilter
Constructor for SmudgeFilter.- Parameters:
db- aRepositoryobject.in- aInputStreamobject. The stream is closed in any case.out- aOutputStreamobject.- Throws:
IOException- in case of an error
-
SmudgeFilter
- Throws:
IOException
-
-
Method Details
-
register
static void register()Register this filter in JGit -
downloadLfsResource
public static Collection<Path> downloadLfsResource(Lfs lfs, Repository db, LfsPointer... res) throws IOException Download content which is hosted on a LFS server- Parameters:
lfs- localLfsstorage.db- the repository to work withres- the objects to download- Returns:
- the paths of all mediafiles which have been downloaded
- Throws:
IOException- Since:
- 4.11
-
run
Execute the command. The command is supposed to read data fromFilterCommand.inand to write the result toFilterCommand.out. It returns the number of bytes it read fromFilterCommand.in. It should be called in a loop until it returns -1 signaling that theInputStreamis completely processed.On successful completion (return -1) or on Exception, the streams
FilterCommand.inandFilterCommand.outare closed by the implementation.- Specified by:
runin classFilterCommand- Returns:
- the number of bytes read from the
InputStreamor -1. -1 means that theInputStreamis completely processed. - Throws:
IOException- whenIOExceptionoccurred while reading fromFilterCommand.inor writing toFilterCommand.out
-