summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 09d7dd7)
raw | patch | inline | side by side (parent: 09d7dd7)
author | Michael Haggerty <mhagger@alum.mit.edu> | |
Thu, 4 Aug 2011 04:36:17 +0000 (06:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Aug 2011 22:53:16 +0000 (15:53 -0700) |
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>
availability simplifies other code.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/api-gitattributes.txt | patch | blob | history | |
attr.c | patch | blob | history | |
attr.h | patch | blob | history |
diff --git a/Documentation/technical/api-gitattributes.txt b/Documentation/technical/api-gitattributes.txt
index 916720f7ace3b8504daadacbd5cf60121adff0fb..ab3a84d2f716e7f43209b8fda10f8713facce008 100644 (file)
An attribute is an opaque object that is identified by its name.
Pass the name to `git_attr()` function to obtain the object of
this type. The internal representation of this structure is
An attribute is an opaque object that is identified by its name.
Pass the name to `git_attr()` function to obtain the object of
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`::
index b1d1d6d791687afc98e273db983b8f8727fcd424..bfa1f43793c841d05980d13bb0e864cbcebadf67 100644 (file)
--- a/attr.c
+++ b/attr.c
static struct git_attr_check *check_all_attr;
static struct git_attr *(git_attr_hash[HASHSIZE]);
static struct git_attr_check *check_all_attr;
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)
{
unsigned val = 0, c;
static unsigned hash_name(const char *name, int namelen)
{
unsigned val = 0, c;
index 8b3f19be67f17c1fbf6edb37ac3ea27002ca6415..d4f875a3d509b97a1cda925511ce6658692ca551 100644 (file)
--- a/attr.h
+++ b/attr.h
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 *);
enum git_attr_direction {
int git_checkattr(const char *path, int, struct git_attr_check *);
enum git_attr_direction {