summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-07-21 14:15:12 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-08-11 20:47:59 +0100
commitfba3bf79780406cad976086cbba8b9684073ba9d (patch)
tree5b30d7aff192c77057cb58d9b2434ee06d4b120d /src/blob.c
parentf0f27c1c2b2bf875a6d86c24f8564580732f55c6 (diff)
downloadlibgit2-fba3bf79780406cad976086cbba8b9684073ba9d.tar.gz
blob: optionally read attributes from repository
When `GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD` is passed to `git_blob_filter`, read attributes from `gitattributes` files that are checked in to the repository at the HEAD revision. This passes the flag `GIT_FILTER_ATTRIBUTES_FROM_HEAD` to the filter functions.
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/blob.c b/src/blob.c
index 7db05f046..487e608b7 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -428,6 +428,9 @@ int git_blob_filter(
if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
+ if ((opts.flags & GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD) != 0)
+ flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
+
if (!(error = git_filter_list_load(
&fl, git_blob_owner(blob), blob, path,
GIT_FILTER_TO_WORKTREE, flags))) {