Commit a5392eae by Edward Thomson

blob: allow blob filtering to ignore system gitattributes

Introduce `GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES`, which tells
`git_blob_filter` to ignore the system-wide attributes file, usually
`/etc/gitattributes`.

This simply passes the appropriate flag to the attribute loading code.
parent 22eb12af
......@@ -102,6 +102,12 @@ GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
typedef enum {
/** When set, filters will not be applied to binary files. */
GIT_BLOB_FILTER_CHECK_FOR_BINARY = (1 << 0),
/**
* When set, filters will not load configuration from the
* system-wide `gitattributes` in `/etc` (or system equivalent).
*/
GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES = (1 << 1),
} git_blob_filter_flag_t;
/**
......
......@@ -425,6 +425,9 @@ int git_blob_filter(
git_blob_is_binary(blob))
return 0;
if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
if (!(error = git_filter_list_load(
&fl, git_blob_owner(blob), blob, path,
GIT_FILTER_TO_WORKTREE, flags))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment