summaryrefslogtreecommitdiff
path: root/src/filter.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-07-21 12:12:05 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-08-11 20:47:59 +0100
commit22eb12afef4785fac47d56e2e8a13c840294ca4a (patch)
treee6b79c10f31cd4cc8b964970749e705d81e2dc52 /src/filter.c
parente7fc8601ff9a68a5bfdc26e6073f7821b8f9b05c (diff)
downloadlibgit2-22eb12afef4785fac47d56e2e8a13c840294ca4a.tar.gz
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.
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/filter.c b/src/filter.c
index 6c929c030..c2f76039e 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -428,13 +428,18 @@ static int filter_list_check_attributes(
git_filter_def *fdef,
const git_filter_source *src)
{
- int error;
- size_t i;
const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
+ uint32_t flags = 0;
+ size_t i;
+ int error;
+
GIT_ERROR_CHECK_ALLOC(strs);
+ if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
+ flags |= GIT_ATTR_CHECK_NO_SYSTEM;
+
error = git_attr_get_many_with_session(
- strs, repo, attr_session, 0, src->path, fdef->nattrs, fdef->attrs);
+ strs, repo, attr_session, flags, src->path, fdef->nattrs, fdef->attrs);
/* if no values were found but no matches are needed, it's okay! */
if (error == GIT_ENOTFOUND && !fdef->nmatches) {