Commit 227f3131 by Vicent Marti

attr: Rename the `git_attr__` exports

Pevents collisions with the original libgit, which also exports those
exact symbols.

Fixes #822
parent d1af70b0
...@@ -30,7 +30,7 @@ GIT_BEGIN_DECL ...@@ -30,7 +30,7 @@ GIT_BEGIN_DECL
* Then for file `xyz.c` looking up attribute "foo" gives a value for * Then for file `xyz.c` looking up attribute "foo" gives a value for
* which `GIT_ATTR_TRUE(value)` is true. * which `GIT_ATTR_TRUE(value)` is true.
*/ */
#define GIT_ATTR_TRUE(attr) ((attr) == git_attr__true) #define GIT_ATTR_TRUE(attr) ((attr) == git_l_attr__true)
/** /**
* GIT_ATTR_FALSE checks if an attribute is set off. In core git * GIT_ATTR_FALSE checks if an attribute is set off. In core git
...@@ -44,7 +44,7 @@ GIT_BEGIN_DECL ...@@ -44,7 +44,7 @@ GIT_BEGIN_DECL
* Then for file `zyx.h` looking up attribute "foo" gives a value for * Then for file `zyx.h` looking up attribute "foo" gives a value for
* which `GIT_ATTR_FALSE(value)` is true. * which `GIT_ATTR_FALSE(value)` is true.
*/ */
#define GIT_ATTR_FALSE(attr) ((attr) == git_attr__false) #define GIT_ATTR_FALSE(attr) ((attr) == git_l_attr__false)
/** /**
* GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This * GIT_ATTR_UNSPECIFIED checks if an attribute is unspecified. This
...@@ -62,7 +62,7 @@ GIT_BEGIN_DECL ...@@ -62,7 +62,7 @@ GIT_BEGIN_DECL
* file `onefile.rb` or looking up "bar" on any file will all give * file `onefile.rb` or looking up "bar" on any file will all give
* `GIT_ATTR_UNSPECIFIED(value)` of true. * `GIT_ATTR_UNSPECIFIED(value)` of true.
*/ */
#define GIT_ATTR_UNSPECIFIED(attr) (!(attr) || (attr) == git_attr__unset) #define GIT_ATTR_UNSPECIFIED(attr) (!(attr) || (attr) == git_l_attr__unset)
/** /**
* GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as * GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as
...@@ -75,12 +75,12 @@ GIT_BEGIN_DECL ...@@ -75,12 +75,12 @@ GIT_BEGIN_DECL
* string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true. * string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true.
*/ */
#define GIT_ATTR_HAS_VALUE(attr) \ #define GIT_ATTR_HAS_VALUE(attr) \
((attr) && (attr) != git_attr__unset && \ ((attr) && (attr) != git_l_attr__unset && \
(attr) != git_attr__true && (attr) != git_attr__false) (attr) != git_l_attr__true && (attr) != git_attr__false)
GIT_EXTERN(const char *) git_attr__true; GIT_EXTERN(const char *) git_l_attr__true;
GIT_EXTERN(const char *) git_attr__false; GIT_EXTERN(const char *) git_l_attr__false;
GIT_EXTERN(const char *) git_attr__unset; GIT_EXTERN(const char *) git_l_attr__unset;
/** /**
* Check attribute flags: Reading values from index and working directory. * Check attribute flags: Reading values from index and working directory.
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include "git2/tree.h" #include "git2/tree.h"
#include <ctype.h> #include <ctype.h>
const char *git_attr__true = "[internal]__TRUE__"; const char *git_l_attr__true = "[internal]__TRUE__";
const char *git_attr__false = "[internal]__FALSE__"; const char *git_l_attr__false = "[internal]__FALSE__";
const char *git_attr__unset = "[internal]__UNSET__"; const char *git_l_attr__unset = "[internal]__UNSET__";
static int sort_by_hash_and_name(const void *a_raw, const void *b_raw); static int sort_by_hash_and_name(const void *a_raw, const void *b_raw);
static void git_attr_rule__clear(git_attr_rule *rule); static void git_attr_rule__clear(git_attr_rule *rule);
...@@ -503,14 +503,14 @@ int git_attr_assignment__parse( ...@@ -503,14 +503,14 @@ int git_attr_assignment__parse(
} }
assign->name_hash = 5381; assign->name_hash = 5381;
assign->value = git_attr__true; assign->value = git_l_attr__true;
/* look for magic name prefixes */ /* look for magic name prefixes */
if (*scan == '-') { if (*scan == '-') {
assign->value = git_attr__false; assign->value = git_l_attr__false;
scan++; scan++;
} else if (*scan == '!') { } else if (*scan == '!') {
assign->value = git_attr__unset; /* explicit unspecified state */ assign->value = git_l_attr__unset; /* explicit unspecified state */
scan++; scan++;
} else if (*scan == '#') /* comment rest of line */ } else if (*scan == '#') /* comment rest of line */
break; break;
...@@ -546,7 +546,7 @@ int git_attr_assignment__parse( ...@@ -546,7 +546,7 @@ int git_attr_assignment__parse(
} }
/* expand macros (if given a repo with a macro cache) */ /* expand macros (if given a repo with a macro cache) */
if (repo != NULL && assign->value == git_attr__true) { if (repo != NULL && assign->value == git_l_attr__true) {
git_attr_rule *macro = git_attr_rule *macro =
git_attr_cache__lookup_macro(repo, assign->name); git_attr_cache__lookup_macro(repo, assign->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment