33 Commits

Author SHA1 Message Date
Edward Thomson
be8a761157 docs: specify flags parameters 2026-06-25 23:19:40 +01:00
Edward Thomson
8357107057 add nonexistent options_init functions
All `options` structures should have a corresponding `options_init`
function.
2026-06-25 23:17:17 +01:00
Edward Thomson
d9154e1885 docs: specify options structure init 2026-06-25 23:17:17 +01:00
Edward Thomson
e32cb67d61 docs: specify out params 2026-06-25 23:17:17 +01:00
Edward Thomson
3c7234e3a0 Update filter.h 2026-05-30 18:52:36 +01:00
yoni_ash
3f1d5c1fa9 Fix a small documentation error 2026-05-29 14:52:16 +04:00
Edward Thomson
338ceb93b6 Improve documentation 2024-11-26 21:44:09 +00:00
punkymaniac
68bc511abb Add documentation about parameter and return value 2022-01-09 10:17:51 +01:00
Peter Pettersson
38c3449822 Make enum in includes C90 compliant by removing trailing comma. 2021-11-15 16:45:40 +01:00
Edward Thomson
90656858ce filter: use a git_oid in filter options, not a pointer
Using a `git_oid *` in filter options was a mistake; it is a deviation
from our typical pattern, and callers in some languages that GC may need
very special treatment in order to pass both an options structure and a
pointer outside of it.
2021-09-21 11:28:39 -04:00
Edward Thomson
1439b9ff05 filter: introduce GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT
Provide a mechanism to filter using attribute data from a specific
commit (making use of `GIT_ATTR_CHECK_INCLUDE_COMMIT`).
2021-07-22 16:40:42 -04:00
Edward Thomson
d7e8b9348c filter: add git_filter_options
Allow filter users to provide an options structure instead of simply
flags.  This allows for future growth for filter options.
2021-07-22 16:22:28 -04:00
Edward Thomson
68b9605acc filter: deprecate git_filter_list_apply_to_data
Deprecate `git_filter_list_apply_to_data` as it takes user input as a
`git_buf`.  Users should use `git_filter_list_apply_to_buffer` instead.
2021-05-06 16:31:54 +01:00
Edward Thomson
5309b4654e filter: introduce git_filter_list_apply_to_buffer
Provide a filter application mechanism that takes a user-provided string
and length, instead of a `git_buf`.
2021-05-06 15:24:30 +01:00
Edward Thomson
26846f4cdb filter: remove git_buf sharing in git_filter_list_apply_to_data
The API `git_filter_list_apply_to_data` shares data between its out and
in parameters to avoid unnecessarily copying it when there are no
filters to apply.  However, it does so in a manner that is potentially
confusing, leaving both `git_buf`s populated with data.  This is risky
for end-users who have to know how to deal with this.  Instead, we
remove this optimization - users who want to avoid unnecessary copies
can use the longstanding streaming API or check the filter status before
invoking the filters.
2021-05-06 15:19:58 +01:00
Edward Thomson
9869f1e5a3 filter: deprecate git_filter_list_stream_data
`git_filter_list_stream_data` takes user input in a `git_buf`.
`git_buf` should only be used when libgit2 itself needs to allocate data
and returned to a user that they can free when they wish.  Replace it
with `git_filter_list_stream_buffer` that takes a data buffer and
length.
2021-05-06 15:06:41 +01:00
Edward Thomson
f0f27c1c2b filter: optionally read attributes from repository
When `GIT_FILTER_ATTRIBUTES_FROM_HEAD` is specified, configure the
filter to read filter attributes from `gitattributes` files that are
checked in to the repository at the HEAD revision.  This passes the flag
`GIT_ATTR_CHECK_INCLUDE_HEAD` to the attribute reading functions.
2019-08-11 20:47:59 +01:00
Edward Thomson
22eb12afef filter: add GIT_FILTER_NO_SYSTEM_ATTRIBUTES option
Allow system-wide attributes (the ones specified in
`/etc/gitattributes`) to be ignored if the flag
`GIT_FILTER_NO_SYSTEM_ATTRIBUTES` is specified.
2019-08-11 20:47:59 +01:00
Edward Thomson
45ddb58634 filter: document GIT_FILTER_ALLOW_UNSAFE 2019-08-11 20:47:59 +01:00
Carlos Martín Nieto
a94d3e68bf filter: add docs for streaming filters
These functions are available on the public API but don't have any
documentation, so they don't appear on the API reference. Fix that.
2015-07-03 14:36:41 +02:00
Edward Thomson
2eecc2886b Introduce git_filter_list_contains
`git_filter_list_contains` can be used to query a filter list to
determine if a given filter will be run.
2015-06-10 14:43:49 -04:00
Edward Thomson
795eaccd66 git_filter_opt_t -> git_filter_flag_t
For consistency with the rest of the library, where an opt is an
options *structure*.
2015-02-19 11:09:54 -05:00
Edward Thomson
b75f15aaf1 git_writestream: from git_filter_stream 2015-02-18 10:24:23 -05:00
Edward Thomson
fbdc9db364 filters: introduce streaming filters
Add structures and preliminary functions to take a buffer, file or
blob and write the contents in chunks through an arbitrary number
of chained filters, finally writing into a user-provided function
accept the contents.
2015-02-17 02:19:05 -05:00
Carlos Martín Nieto
a295bd2dc4 doc: add documentation to all the public structs and enums
This makes them show up in the reference, even if the text itself isn't
the most descriptive.

These have been found with

    grep -Przon '\n\ntypedef struct.*?\{' -- include
    grep -Przon '\n\ntypedef enum.*?\{' -- include
2014-12-06 03:44:40 +01:00
Russell Belfer
45c53eb6cb Use unsigned type for APIs with opt flag mask 2014-05-08 10:46:04 -07:00
Russell Belfer
5269008cf6 Add filter options and ALLOW_UNSAFE
Diff and status do not want core.safecrlf to actually raise an
error regardless of the setting, so this extends the filter API
with an additional options flags parameter and adds a flag so that
filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
that unsafe filter application should be downgraded from a failure
to a warning.
2014-05-06 16:01:49 -07:00
Russell Belfer
a9f51e430f Merge git_buf and git_buffer
This makes the git_buf struct that was used internally into an
externally available structure and eliminates the git_buffer.

As part of that, some of the special cases that arose with the
externally used git_buffer were blended into the git_buf, such as
being careful about git_buf objects that may have a NULL ptr and
allowing for bufs with a valid ptr and size but zero asize as a
way of referring to externally owned data.
2013-09-17 09:31:45 -07:00
Russell Belfer
4b11f25a4f Add ident filter
This adds the ident filter (that knows how to replace $Id$) and
tweaks the filter APIs and code so that git_filter_source objects
actually have the updated OID of the object being filtered when
it is a known value.
2013-09-17 09:31:45 -07:00
Russell Belfer
40cb40fab9 Add functions to manipulate filter lists
Extend the git2/sys/filter API with functions to look up a filter
and add it manually to a filter list.  This requires some trickery
because the regular attribute lookups and checks are bypassed when
this happens, but in the right hands, it will allow a user to have
granular control over applying filters.
2013-09-17 09:31:45 -07:00
Russell Belfer
2a7d224f99 Extend public filter api with filter lists
This moves the git_filter_list into the public API so that users
can create, apply, and dispose of filter lists.  This allows more
granular application of filters to user data outside of libgit2
internals.

This also converts all the internal usage of filters to the public
APIs along with a few small tweaks to make it easier to use the
public git_buffer stuff alongside the internal git_buf.
2013-09-17 09:31:44 -07:00
Russell Belfer
85d5481206 Create public filter object and use it
This creates include/sys/filter.h with a basic definition of a
git_filter and then converts the internal code to use it.  There
are related internal objects (git_filter_list) that we will want
to publish at some point, but this is a first step.
2013-09-17 09:30:06 -07:00
Russell Belfer
0cf77103b2 Start of filter API + git_blob_filtered_content
This begins the process of exposing git_filter objects to the
public API.  This includes:

* new public type and API for `git_buffer` through which an
  allocated buffer can be passed to the user
* new API `git_blob_filtered_content`
* make the git_filter type and GIT_FILTER_TO_... constants public
2013-09-17 09:30:06 -07:00