1 Fix for https://github.com/libgit2/libgit2/issues/824
3 include/git2/attr.h | 63 -----------------------------------------------------
4 src/attr_file.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5 2 files changed, 63 insertions(+), 63 deletions(-)
7 diff --git a/include/git2/attr.h b/include/git2/attr.h
8 index fad7183..9b567b6 100644
9 --- a/include/git2/attr.h
10 +++ b/include/git2/attr.h
15 - * GIT_ATTR_TRUE checks if an attribute is set on. In core git
16 - * parlance, this the value for "Set" attributes.
18 - * For example, if the attribute file contains:
22 - * Then for file `xyz.c` looking up attribute "foo" gives a value for
23 - * which `GIT_ATTR_TRUE(value)` is true.
25 -#define GIT_ATTR_TRUE(attr) ((attr) == git_l_attr__true)
28 - * GIT_ATTR_FALSE checks if an attribute is set off. In core git
29 - * parlance, this is the value for attributes that are "Unset" (not to
30 - * be confused with values that a "Unspecified").
32 - * For example, if the attribute file contains:
36 - * Then for file `zyx.h` looking up attribute "foo" gives a value for
37 - * which `GIT_ATTR_FALSE(value)` is true.
39 -#define GIT_ATTR_FALSE(attr) ((attr) == git_l_attr__false)
42 - * GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
43 - * may be due to the attribute not being mentioned at all or because
44 - * the attribute was explicitly set unspecified via the `!` operator.
46 - * For example, if the attribute file contains:
52 - * Then for `onefile.c` looking up attribute "foo" yields a value with
53 - * `GIT_ATTR_UNSPECIFIED(value)` of true. Also, looking up "foo" on
54 - * file `onefile.rb` or looking up "bar" on any file will all give
55 - * `GIT_ATTR_UNSPECIFIED(value)` of true.
57 -#define GIT_ATTR_UNSPECIFIED(attr) (!(attr) || (attr) == git_l_attr__unset)
60 - * GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
61 - * opposed to TRUE, FALSE or UNSPECIFIED). This would be the case if
62 - * for a file with something like:
66 - * Given this, looking up "eol" for `onefile.txt` will give back the
67 - * string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
69 -#define GIT_ATTR_HAS_VALUE(attr) \
70 - ((attr) && (attr) != git_l_attr__unset && \
71 - (attr) != git_l_attr__true && (attr) != git_attr__false)
73 -GIT_EXTERN(const char *) git_l_attr__true;
74 -GIT_EXTERN(const char *) git_l_attr__false;
75 -GIT_EXTERN(const char *) git_l_attr__unset;
78 * Check attribute flags: Reading values from index and working directory.
80 * When checking attributes, it is possible to check attribute files
81 diff --git a/src/attr_file.h b/src/attr_file.h
82 index 7939f83..fb93e65 100644
85 @@ -142,4 +142,67 @@ extern int git_attr_assignment__parse(
90 + * GIT_ATTR_TRUE checks if an attribute is set on. In core git
91 + * parlance, this the value for "Set" attributes.
93 + * For example, if the attribute file contains:
97 + * Then for file `xyz.c` looking up attribute "foo" gives a value for
98 + * which `GIT_ATTR_TRUE(value)` is true.
100 +#define GIT_ATTR_TRUE(attr) ((attr) == git_l_attr__true)
103 + * GIT_ATTR_FALSE checks if an attribute is set off. In core git
104 + * parlance, this is the value for attributes that are "Unset" (not to
105 + * be confused with values that a "Unspecified").
107 + * For example, if the attribute file contains:
111 + * Then for file `zyx.h` looking up attribute "foo" gives a value for
112 + * which `GIT_ATTR_FALSE(value)` is true.
114 +#define GIT_ATTR_FALSE(attr) ((attr) == git_l_attr__false)
117 + * GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
118 + * may be due to the attribute not being mentioned at all or because
119 + * the attribute was explicitly set unspecified via the `!` operator.
121 + * For example, if the attribute file contains:
127 + * Then for `onefile.c` looking up attribute "foo" yields a value with
128 + * `GIT_ATTR_UNSPECIFIED(value)` of true. Also, looking up "foo" on
129 + * file `onefile.rb` or looking up "bar" on any file will all give
130 + * `GIT_ATTR_UNSPECIFIED(value)` of true.
132 +#define GIT_ATTR_UNSPECIFIED(attr) (!(attr) || (attr) == git_l_attr__unset)
135 + * GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
136 + * opposed to TRUE, FALSE or UNSPECIFIED). This would be the case if
137 + * for a file with something like:
141 + * Given this, looking up "eol" for `onefile.txt` will give back the
142 + * string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
144 +#define GIT_ATTR_HAS_VALUE(attr) \
145 + ((attr) && (attr) != git_l_attr__unset && \
146 + (attr) != git_l_attr__true && (attr) != git_attr__false)
148 +GIT_EXTERN(const char *) git_l_attr__true;
149 +GIT_EXTERN(const char *) git_l_attr__false;
150 +GIT_EXTERN(const char *) git_l_attr__unset;