Blame attr.h

Packit 4511e4
#ifndef ATTR_H
Packit 4511e4
#define ATTR_H
Packit 4511e4
Packit 4511e4
/* An attribute is a pointer to this opaque structure */
Packit 4511e4
struct git_attr;
Packit 4511e4
Packit 4511e4
/* opaque structures used internally for attribute collection */
Packit 4511e4
struct all_attrs_item;
Packit 4511e4
struct attr_stack;
Packit 4511e4
Packit 4511e4
/*
Packit 4511e4
 * Given a string, return the gitattribute object that
Packit 4511e4
 * corresponds to it.
Packit 4511e4
 */
Packit 4511e4
const struct git_attr *git_attr(const char *);
Packit 4511e4
Packit 4511e4
/* Internal use */
Packit 4511e4
extern const char git_attr__true[];
Packit 4511e4
extern const char git_attr__false[];
Packit 4511e4
Packit 4511e4
/* For public to check git_attr_check results */
Packit 4511e4
#define ATTR_TRUE(v) ((v) == git_attr__true)
Packit 4511e4
#define ATTR_FALSE(v) ((v) == git_attr__false)
Packit 4511e4
#define ATTR_UNSET(v) ((v) == NULL)
Packit 4511e4
Packit 4511e4
/*
Packit 4511e4
 * Send one or more git_attr_check to git_check_attrs(), and
Packit 4511e4
 * each 'value' member tells what its value is.
Packit 4511e4
 * Unset one is returned as NULL.
Packit 4511e4
 */
Packit 4511e4
struct attr_check_item {
Packit 4511e4
	const struct git_attr *attr;
Packit 4511e4
	const char *value;
Packit 4511e4
};
Packit 4511e4
Packit 4511e4
struct attr_check {
Packit 4511e4
	int nr;
Packit 4511e4
	int alloc;
Packit 4511e4
	struct attr_check_item *items;
Packit 4511e4
	int all_attrs_nr;
Packit 4511e4
	struct all_attrs_item *all_attrs;
Packit 4511e4
	struct attr_stack *stack;
Packit 4511e4
};
Packit 4511e4
Packit 4511e4
extern struct attr_check *attr_check_alloc(void);
Packit 4511e4
extern struct attr_check *attr_check_initl(const char *, ...);
Packit 4511e4
extern struct attr_check *attr_check_dup(const struct attr_check *check);
Packit 4511e4
Packit 4511e4
extern struct attr_check_item *attr_check_append(struct attr_check *check,
Packit 4511e4
						 const struct git_attr *attr);
Packit 4511e4
Packit 4511e4
extern void attr_check_reset(struct attr_check *check);
Packit 4511e4
extern void attr_check_clear(struct attr_check *check);
Packit 4511e4
extern void attr_check_free(struct attr_check *check);
Packit 4511e4
Packit 4511e4
/*
Packit 4511e4
 * Return the name of the attribute represented by the argument.  The
Packit 4511e4
 * return value is a pointer to a null-delimited string that is part
Packit 4511e4
 * of the internal data structure; it should not be modified or freed.
Packit 4511e4
 */
Packit 4511e4
extern const char *git_attr_name(const struct git_attr *);
Packit 4511e4
Packit 4511e4
extern int git_check_attr(const char *path, struct attr_check *check);
Packit 4511e4
Packit 4511e4
/*
Packit 4511e4
 * Retrieve all attributes that apply to the specified path.
Packit 4511e4
 * check holds the attributes and their values.
Packit 4511e4
 */
Packit 4511e4
extern void git_all_attrs(const char *path, struct attr_check *check);
Packit 4511e4
Packit 4511e4
enum git_attr_direction {
Packit 4511e4
	GIT_ATTR_CHECKIN,
Packit 4511e4
	GIT_ATTR_CHECKOUT,
Packit 4511e4
	GIT_ATTR_INDEX
Packit 4511e4
};
Packit 4511e4
void git_attr_set_direction(enum git_attr_direction new_direction,
Packit 4511e4
			    struct index_state *istate);
Packit 4511e4
Packit 4511e4
extern void attr_start(void);
Packit 4511e4
Packit 4511e4
#endif /* ATTR_H */