Provide access to the name attribute of git_attr
It will be present in any likely future reimplementation, and its availability simplifies other code. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
09d7dd7ad6
commit
352404ac4c
@ -13,7 +13,8 @@ Data Structure
|
|||||||
An attribute is an opaque object that is identified by its name.
|
An attribute is an opaque object that is identified by its name.
|
||||||
Pass the name to `git_attr()` function to obtain the object of
|
Pass the name to `git_attr()` function to obtain the object of
|
||||||
this type. The internal representation of this structure is
|
this type. The internal representation of this structure is
|
||||||
of no interest to the calling programs.
|
of no interest to the calling programs. The name of the
|
||||||
|
attribute can be retrieved by calling `git_attr_name()`.
|
||||||
|
|
||||||
`struct git_attr_check`::
|
`struct git_attr_check`::
|
||||||
|
|
||||||
|
5
attr.c
5
attr.c
@ -36,6 +36,11 @@ static int attr_nr;
|
|||||||
static struct git_attr_check *check_all_attr;
|
static struct git_attr_check *check_all_attr;
|
||||||
static struct git_attr *(git_attr_hash[HASHSIZE]);
|
static struct git_attr *(git_attr_hash[HASHSIZE]);
|
||||||
|
|
||||||
|
char *git_attr_name(struct git_attr *attr)
|
||||||
|
{
|
||||||
|
return attr->name;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned hash_name(const char *name, int namelen)
|
static unsigned hash_name(const char *name, int namelen)
|
||||||
{
|
{
|
||||||
unsigned val = 0, c;
|
unsigned val = 0, c;
|
||||||
|
7
attr.h
7
attr.h
@ -29,6 +29,13 @@ struct git_attr_check {
|
|||||||
const char *value;
|
const char *value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the name of the attribute represented by the argument. The
|
||||||
|
* return value is a pointer to a null-delimited string that is part
|
||||||
|
* of the internal data structure; it should not be modified or freed.
|
||||||
|
*/
|
||||||
|
char *git_attr_name(struct git_attr *);
|
||||||
|
|
||||||
int git_checkattr(const char *path, int, struct git_attr_check *);
|
int git_checkattr(const char *path, int, struct git_attr_check *);
|
||||||
|
|
||||||
enum git_attr_direction {
|
enum git_attr_direction {
|
||||||
|
Reference in New Issue
Block a user