logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Git::Raw::Filter - Git filter class

Author

       Alessandro Ghedini <alexbio@cpan.org>

       Jacques Germishuys <jacquesg@cpan.org>

Description

       A Git::Raw::Filter represents a Git filter.

       WARNING: The API of this module is unstable and may change without warning (any change will be
       appropriately documented in the changelog).

Methods

create($name,$attributes)
       Create a filter. $name is a name by which the filter can be referenced.  $attributes is a whitespace-
       separated list of attribute names to check for this filter (e.g. "eol crlf text"). If the attribute name
       is bare, it will simply be loaded and passed to the "check" callback.  If it has a value (i.e.
       "name=value"), the attribute must match that value for the filter to be applied.

   callbacks(\%callbacks)
       Set the callbacks for the filter. %callbacks may specify the following callbacks.

       •   "initialize"

           Optional callback to be invoked before a filter is first used. It will be called once at most.

       •   "shutdown"

           Optional callback to be invoked when the filter is unregistered or when the library is shutting down.
           It will be called once at most. This may be called even if "initialize" has never been called.

       •   "check"

           Optional  callback  that checks if filtering is needed for a given source.  The callback receives the
           following parameters: The filter source, a Git::Raw::Filter::Source object.

           If the filter should be applied, "Git::Raw::Error->OK" should be returned.  If the filter  should  be
           skipped, "Git::Raw::Error->PASSTHROUGH" should be returned.

       •   "apply"

           Callback that actually filters data.

           The callback receives the following parameters: The filter source, a Git::Raw::Filter::Source object,
           $from the source data and $to, a scalar reference where the output should be written to.

           If the filter successfully writes the output, "Git::Raw::Error->OK" should be returned. If the filter
           failed,   "Git::Raw::Error->ERROR"  should  be  returned.  If  the  filter  does  not  want  to  run,
           "Git::Raw::Error->PASSTHROUGH" should be returned.

       •   "cleanup"

           Optional callback to clean up after filtering has been applied.

   register($priority)
       Register the filter with priority $priority.

   unregister()
       Remove the filter.

Name

       Git::Raw::Filter - Git filter class

Version

       version 0.90

See Also