mirror of
https://github.com/git/git.git
synced 2024-11-15 13:43:45 +01:00
515106fa13
This allows you to define three values (and possibly more) to each attribute: true, false, and unset. Typically the handlers that notice and act on attribute values treat "unset" attribute to mean "do your default thing" (e.g. crlf that is unset would trigger "guess from contents"), so being able to override a setting to an unset state is actually useful. - If you want to set the attribute value to true, have an entry in .gitattributes file that mentions the attribute name; e.g. *.o binary - If you want to set the attribute value explicitly to false, use '-'; e.g. *.a -diff - If you want to make the attribute value _unset_, perhaps to override an earlier entry, use '!'; e.g. *.a -diff c.i.a !diff This also allows string values to attributes, with the natural syntax: attrname=attrvalue but you cannot use it, as nobody takes notice and acts on it yet. Signed-off-by: Junio C Hamano <junkio@cox.net>
26 lines
603 B
C
26 lines
603 B
C
#ifndef ATTR_H
|
|
#define ATTR_H
|
|
|
|
/* An attribute is a pointer to this opaque structure */
|
|
struct git_attr;
|
|
|
|
struct git_attr *git_attr(const char *, int);
|
|
|
|
/* Internal use */
|
|
#define ATTR__TRUE ((void *) 1)
|
|
#define ATTR__FALSE ((void *) 0)
|
|
#define ATTR__UNSET ((void *) -1)
|
|
|
|
/* For public to check git_attr_check results */
|
|
#define ATTR_TRUE(v) ((v) == ATTR__TRUE)
|
|
#define ATTR_FALSE(v) ((v) == ATTR__FALSE)
|
|
#define ATTR_UNSET(v) ((v) == ATTR__UNSET)
|
|
|
|
struct git_attr_check {
|
|
struct git_attr *attr;
|
|
void *value;
|
|
};
|
|
|
|
int git_checkattr(const char *path, int, struct git_attr_check *);
|
|
|
|
#endif /* ATTR_H */
|