vendor/libgit2/include/git2/attr.h in rugged-0.28.5 vs vendor/libgit2/include/git2/attr.h in rugged-0.99.0
- old
+ new
@@ -28,11 +28,11 @@
* *.c foo
*
* Then for file `xyz.c` looking up attribute "foo" gives a value for
* which `GIT_ATTR_TRUE(value)` is true.
*/
-#define GIT_ATTR_TRUE(attr) (git_attr_value(attr) == GIT_ATTR_TRUE_T)
+#define GIT_ATTR_IS_TRUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_TRUE)
/**
* GIT_ATTR_FALSE checks if an attribute is set off. In core git
* parlance, this is the value for attributes that are "Unset" (not to
* be confused with values that a "Unspecified").
@@ -42,11 +42,11 @@
* *.h -foo
*
* Then for file `zyx.h` looking up attribute "foo" gives a value for
* which `GIT_ATTR_FALSE(value)` is true.
*/
-#define GIT_ATTR_FALSE(attr) (git_attr_value(attr) == GIT_ATTR_FALSE_T)
+#define GIT_ATTR_IS_FALSE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_FALSE)
/**
* GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
* may be due to the attribute not being mentioned at all or because
* the attribute was explicitly set unspecified via the `!` operator.
@@ -60,11 +60,11 @@
* Then for `onefile.c` looking up attribute "foo" yields a value with
* `GIT_ATTR_UNSPECIFIED(value)` of true. Also, looking up "foo" on
* file `onefile.rb` or looking up "bar" on any file will all give
* `GIT_ATTR_UNSPECIFIED(value)` of true.
*/
-#define GIT_ATTR_UNSPECIFIED(attr) (git_attr_value(attr) == GIT_ATTR_UNSPECIFIED_T)
+#define GIT_ATTR_IS_UNSPECIFIED(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_UNSPECIFIED)
/**
* GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
* opposed to TRUE, FALSE or UNSPECIFIED). This would be the case if
* for a file with something like:
@@ -72,21 +72,21 @@
* *.txt eol=lf
*
* Given this, looking up "eol" for `onefile.txt` will give back the
* string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
*/
-#define GIT_ATTR_HAS_VALUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_T)
+#define GIT_ATTR_HAS_VALUE(attr) (git_attr_value(attr) == GIT_ATTR_VALUE_STRING)
/**
* Possible states for an attribute
*/
typedef enum {
- GIT_ATTR_UNSPECIFIED_T = 0, /**< The attribute has been left unspecified */
- GIT_ATTR_TRUE_T, /**< The attribute has been set */
- GIT_ATTR_FALSE_T, /**< The attribute has been unset */
- GIT_ATTR_VALUE_T, /**< This attribute has a value */
-} git_attr_t;
+ GIT_ATTR_VALUE_UNSPECIFIED = 0, /**< The attribute has been left unspecified */
+ GIT_ATTR_VALUE_TRUE, /**< The attribute has been set */
+ GIT_ATTR_VALUE_FALSE, /**< The attribute has been unset */
+ GIT_ATTR_VALUE_STRING, /**< This attribute has a value */
+} git_attr_value_t;
/**
* Return the value type for a given attribute.
*
* This can be either `TRUE`, `FALSE`, `UNSPECIFIED` (if the attribute
@@ -97,11 +97,11 @@
* as a NULL-terminated C string.
*
* @param attr The attribute
* @return the value type for the attribute
*/
-GIT_EXTERN(git_attr_t) git_attr_value(const char *attr);
+GIT_EXTERN(git_attr_value_t) git_attr_value(const char *attr);
/**
* Check attribute flags: Reading values from index and working directory.
*
* When checking attributes, it is possible to check attribute files
@@ -117,17 +117,24 @@
#define GIT_ATTR_CHECK_FILE_THEN_INDEX 0
#define GIT_ATTR_CHECK_INDEX_THEN_FILE 1
#define GIT_ATTR_CHECK_INDEX_ONLY 2
/**
- * Check attribute flags: Using the system attributes file.
+ * Check attribute flags: controlling extended attribute behavior.
*
* Normally, attribute checks include looking in the /etc (or system
* equivalent) directory for a `gitattributes` file. Passing this
* flag will cause attribute checks to ignore that file.
+ * equivalent) directory for a `gitattributes` file. Passing the
+ * `GIT_ATTR_CHECK_NO_SYSTEM` flag will cause attribute checks to
+ * ignore that file.
+ *
+ * Passing the `GIT_ATTR_CHECK_INCLUDE_HEAD` flag will use attributes
+ * from a `.gitattributes` file in the repository at the HEAD revision.
*/
-#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
+#define GIT_ATTR_CHECK_NO_SYSTEM (1 << 2)
+#define GIT_ATTR_CHECK_INCLUDE_HEAD (1 << 3)
/**
* Look up the value of one git attribute for path.
*
* @param value_out Output of the value of the attribute. Use the GIT_ATTR_...
@@ -229,11 +236,14 @@
*
* Call this if you have reason to believe that the attributes files on
* disk no longer match the cached contents of memory. This will cause
* the attributes files to be reloaded the next time that an attribute
* access function is called.
+ *
+ * @param repo The repository containing the gitattributes cache
+ * @return 0 on success, or an error code
*/
-GIT_EXTERN(void) git_attr_cache_flush(
+GIT_EXTERN(int) git_attr_cache_flush(
git_repository *repo);
/**
* Add a macro definition.
*