Commit f0f27c1c by Edward Thomson

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.
parent 4fd5748c
......@@ -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;
/**
......
......@@ -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);
......
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