summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/git2/blob.h6
-rw-r--r--src/blob.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/include/git2/blob.h b/include/git2/blob.h
index 3710f41bf..923bcf677 100644
--- a/include/git2/blob.h
+++ b/include/git2/blob.h
@@ -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;
/**
diff --git a/src/blob.c b/src/blob.c
index 1af3131ba..7db05f046 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -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))) {