git_filter_register

Register a filter under a given name with a given priority.

As mentioned elsewhere, the initialize callback will not be invoked immediately. It is deferred until the filter is used in some way.

A filter's attribute checks and check and apply callbacks will be issued in order of priority on smudge (to workdir), and in reverse order of priority on clean (to odb).

Two filters are preregistered with libgit2: - GIT_FILTER_CRLF with priority 0 - GIT_FILTER_IDENT with priority 100

Currently the filter registry is not thread safe, so any registering or deregistering of filters must be done outside of any possible usage of the filters (i.e. during application setup or shutdown).

package extern (C) nothrow @nogc
int
git_filter_register
(
const(char)* name
,,)

Parameters

name const(char)*

A name by which the filter can be referenced. Attempting to register with an in-use name will return git_error_code.GIT_EEXISTS.

filter .git_filter*

The filter definition. This pointer will be stored as is by libgit2 so it must be a durable allocation (either static or on the heap).

priority int

The priority for filter application

Return Value

Type: int

0 on successful registry, error code <0 on failure

Meta