summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-gitattributes.txt
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-08-04 04:36:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-04 22:53:18 (GMT)
commitee548df3005d976d4e6a78b3b4454fed812ea28c (patch)
tree8e961b3c8f30bdd1b89f4736902b755491d1ecad /Documentation/technical/api-gitattributes.txt
parent7373eab48e284a808cde766831172d3447f9e320 (diff)
downloadgit-ee548df3005d976d4e6a78b3b4454fed812ea28c.zip
git-ee548df3005d976d4e6a78b3b4454fed812ea28c.tar.gz
git-ee548df3005d976d4e6a78b3b4454fed812ea28c.tar.bz2
Allow querying all attributes on a file
Add a function, git_all_attrs(), that reports on all attributes that are set on a path. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/api-gitattributes.txt')
-rw-r--r--Documentation/technical/api-gitattributes.txt44
1 files changed, 30 insertions, 14 deletions
diff --git a/Documentation/technical/api-gitattributes.txt b/Documentation/technical/api-gitattributes.txt
index ab3a84d..16ccb1c 100644
--- a/Documentation/technical/api-gitattributes.txt
+++ b/Documentation/technical/api-gitattributes.txt
@@ -22,19 +22,6 @@ Data Structure
to `git_checkattr()` function, and receives the results.
-Calling Sequence
-----------------
-
-* Prepare an array of `struct git_attr_check` to define the list of
- attributes you would want to check. To populate this array, you would
- need to define necessary attributes by calling `git_attr()` function.
-
-* Call git_checkattr() to check the attributes for the path.
-
-* Inspect `git_attr_check` structure to see how each of the attribute in
- the array is defined for the path.
-
-
Attribute Values
----------------
@@ -58,6 +45,19 @@ If none of the above returns true, `.value` member points at a string
value of the attribute for the path.
+Querying Specific Attributes
+----------------------------
+
+* Prepare an array of `struct git_attr_check` to define the list of
+ attributes you would want to check. To populate this array, you would
+ need to define necessary attributes by calling `git_attr()` function.
+
+* Call `git_checkattr()` to check the attributes for the path.
+
+* Inspect `git_attr_check` structure to see how each of the attribute in
+ the array is defined for the path.
+
+
Example
-------
@@ -109,4 +109,20 @@ static void setup_check(void)
}
------------
-(JC)
+
+Querying All Attributes
+-----------------------
+
+To get the values of all attributes associated with a file:
+
+* Call `git_all_attrs()`, which returns an array of `git_attr_check`
+ structures.
+
+* Iterate over the `git_attr_check` array to examine the attribute
+ names and values. The name of the attribute described by a
+ `git_attr_check` object can be retrieved via
+ `git_attr_name(check[i].attr)`. (Please note that no items will be
+ returned for unset attributes, so `ATTR_UNSET()` will return false
+ for all returned `git_array_check` objects.)
+
+* Free the `git_array_check` array.