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>
Michael Haggerty committed
Aug 4, 2011 at 06:36 UTC
352404ac4ccab144cd866b1f24c90b8f29ca33c2
3 files changed
+14
-1
Documentation/technical/api-gitattributes.txt
+2
-1
@@ -13,7 +13,8 @@ Data Structure
13
An attribute is an opaque object that is identified by its name.
14
Pass the name to `git_attr()` function to obtain the object of
15
this type. The internal representation of this structure is
16
- of no interest to the calling programs.
16
+ of no interest to the calling programs. The name of the
17
+ attribute can be retrieved by calling `git_attr_name()`.
18
19
`struct git_attr_check`::
20
attr.c
+5
@@ -36,6 +36,11 @@ static int attr_nr;
36
static struct git_attr_check *check_all_attr;
37
static struct git_attr *(git_attr_hash[HASHSIZE]);
38
39
+char *git_attr_name(struct git_attr *attr)
40
+{
41
+ return attr->name;
42
+}
43
+
44
static unsigned hash_name(const char *name, int namelen)
45
{
46
unsigned val = 0, c;
attr.h
+7
@@ -29,6 +29,13 @@ struct git_attr_check {
29
const char *value;
30
};
31
32
+/*
33
+ * Return the name of the attribute represented by the argument. The
34
+ * return value is a pointer to a null-delimited string that is part
35
+ * of the internal data structure; it should not be modified or freed.
36
+ */
37
+char *git_attr_name(struct git_attr *);
38
+
39
int git_checkattr(const char *path, int, struct git_attr_check *);
40
41
enum git_attr_direction {