summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/git2/filter.h3
-rw-r--r--src/filter.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/include/git2/filter.h b/include/git2/filter.h
index a18f071ec..886059051 100644
--- a/include/git2/filter.h
+++ b/include/git2/filter.h
@@ -46,6 +46,9 @@ typedef enum {
/** Don't load `/etc/gitattributes` (or the system equivalent) */
GIT_FILTER_NO_SYSTEM_ATTRIBUTES = (1u << 1),
+
+ /** Load attributes from `.gitattributes` in the root of HEAD */
+ GIT_FILTER_ATTRIBUTES_FROM_HEAD = (1u << 2),
} git_filter_flag_t;
/**
diff --git a/src/filter.c b/src/filter.c
index c2f76039e..7b7e7f172 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -438,6 +438,9 @@ static int filter_list_check_attributes(
if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
flags |= GIT_ATTR_CHECK_NO_SYSTEM;
+ if ((src->flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
+ flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
+
error = git_attr_get_many_with_session(
strs, repo, attr_session, flags, src->path, fdef->nattrs, fdef->attrs);