Class SmudgeFilter


  • public class SmudgeFilter
    extends FilterCommand
    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
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SmudgeFilter​(java.io.InputStream in, java.io.OutputStream out, Repository db)  
        SmudgeFilter​(Repository db, java.io.InputStream in, java.io.OutputStream out)
      Constructor for SmudgeFilter.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Collection<java.nio.file.Path> downloadLfsResource​(Lfs lfs, Repository db, LfsPointer... res)
      Download content which is hosted on a LFS server
      (package private) static void register()
      Register this filter in JGit
      int run()
      Execute the command.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SmudgeFilter

        public SmudgeFilter​(Repository db,
                            java.io.InputStream in,
                            java.io.OutputStream out)
                     throws java.io.IOException
        Constructor for SmudgeFilter.
        Parameters:
        db - a Repository object.
        in - a InputStream object. The stream is closed in any case.
        out - a OutputStream object.
        Throws:
        java.io.IOException - in case of an error
      • SmudgeFilter

        private SmudgeFilter​(java.io.InputStream in,
                             java.io.OutputStream out,
                             Repository db)
                      throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • register

        static void register()
        Register this filter in JGit
      • downloadLfsResource

        public static java.util.Collection<java.nio.file.Path> downloadLfsResource​(Lfs lfs,
                                                                                   Repository db,
                                                                                   LfsPointer... res)
                                                                            throws java.io.IOException
        Download content which is hosted on a LFS server
        Parameters:
        lfs - local Lfs storage.
        db - the repository to work with
        res - the objects to download
        Returns:
        the paths of all mediafiles which have been downloaded
        Throws:
        java.io.IOException
        Since:
        4.11
      • run

        public int run()
                throws java.io.IOException
        Execute the command. The command is supposed to read data from FilterCommand.in and to write the result to FilterCommand.out. It returns the number of bytes it read from FilterCommand.in. It should be called in a loop until it returns -1 signaling that the InputStream is completely processed.

        On successful completion (return -1) or on Exception, the streams FilterCommand.in and FilterCommand.out are closed by the implementation.

        Specified by:
        run in class FilterCommand
        Returns:
        the number of bytes read from the InputStream or -1. -1 means that the InputStream is completely processed.
        Throws:
        java.io.IOException - when IOException occurred while reading from FilterCommand.in or writing to FilterCommand.out