summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-07-22 15:29:46 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-07-22 16:22:28 -0400
commit0bd547a8bee02bf984ea5c7acdc8172044fcb3a4 (patch)
tree4dc86b3fbc275413fccd28405016bbae472adf05 /include
parent093d579f7be5636c52290a517eee1eebb7471e31 (diff)
downloadlibgit2-0bd547a8bee02bf984ea5c7acdc8172044fcb3a4.tar.gz
attr: introduce GIT_ATTR_CHECK_INCLUDE_COMMIT
Introduce `GIT_ATTR_CHECK_INCLUDE_COMMIT`, which like 4fd5748 allows attribute information to be read from files in the repository. 4fd5748 always reads the information from HEAD, while `GIT_ATTR_CHECK_INCLUDE_COMMIT` allows users to provide the commit to read the attributes from.
Diffstat (limited to 'include')
-rw-r--r--include/git2/attr.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/git2/attr.h b/include/git2/attr.h
index 306893c67..62c2ed6e7 100644
--- a/include/git2/attr.h
+++ b/include/git2/attr.h
@@ -130,9 +130,13 @@ GIT_EXTERN(git_attr_value_t) git_attr_value(const char *attr);
*
* Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
* from a `.gitattributes` file in the repository at the HEAD revision.
+ *
+ * Passing the `GIT_ATTR_CHECK_INCLUDE_COMMIT` flag will use attributes
+ * from a `.gitattributes` file in a specific commit.
*/
#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
#define GIT_ATTR_CHECK_INCLUDE_HEAD (1 << 3)
+#define GIT_ATTR_CHECK_INCLUDE_COMMIT (1 << 4)
/**
* An options structure for querying attributes.
@@ -142,6 +146,12 @@ typedef struct {
/** A combination of GIT_ATTR_CHECK flags */
unsigned int flags;
+
+ /**
+ * The commit to load attributes from, when
+ * `GIT_ATTR_CHECK_INCLUDE_COMMIT` is specified.
+ */
+ git_oid *commit_id;
} git_attr_options;
#define GIT_ATTR_OPTIONS_VERSION 1