THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.2KB

  1. #ifndef ATTR_H
  2. #define ATTR_H
  3. struct index_state;
  4. /* An attribute is a pointer to this opaque structure */
  5. struct git_attr;
  6. /* opaque structures used internally for attribute collection */
  7. struct all_attrs_item;
  8. struct attr_stack;
  9. struct index_state;
  10. /*
  11. * Given a string, return the gitattribute object that
  12. * corresponds to it.
  13. */
  14. const struct git_attr *git_attr(const char *);
  15. /* Internal use */
  16. extern const char git_attr__true[];
  17. extern const char git_attr__false[];
  18. /* For public to check git_attr_check results */
  19. #define ATTR_TRUE(v) ((v) == git_attr__true)
  20. #define ATTR_FALSE(v) ((v) == git_attr__false)
  21. #define ATTR_UNSET(v) ((v) == NULL)
  22. /*
  23. * Send one or more git_attr_check to git_check_attrs(), and
  24. * each 'value' member tells what its value is.
  25. * Unset one is returned as NULL.
  26. */
  27. struct attr_check_item {
  28. const struct git_attr *attr;
  29. const char *value;
  30. };
  31. struct attr_check {
  32. int nr;
  33. int alloc;
  34. struct attr_check_item *items;
  35. int all_attrs_nr;
  36. struct all_attrs_item *all_attrs;
  37. struct attr_stack *stack;
  38. };
  39. struct attr_check *attr_check_alloc(void);
  40. struct attr_check *attr_check_initl(const char *, ...);
  41. struct attr_check *attr_check_dup(const struct attr_check *check);
  42. struct attr_check_item *attr_check_append(struct attr_check *check,
  43. const struct git_attr *attr);
  44. void attr_check_reset(struct attr_check *check);
  45. void attr_check_clear(struct attr_check *check);
  46. void attr_check_free(struct attr_check *check);
  47. /*
  48. * Return the name of the attribute represented by the argument. The
  49. * return value is a pointer to a null-delimited string that is part
  50. * of the internal data structure; it should not be modified or freed.
  51. */
  52. const char *git_attr_name(const struct git_attr *);
  53. void git_check_attr(const struct index_state *istate,
  54. const char *path, struct attr_check *check);
  55. /*
  56. * Retrieve all attributes that apply to the specified path.
  57. * check holds the attributes and their values.
  58. */
  59. void git_all_attrs(const struct index_state *istate,
  60. const char *path, struct attr_check *check);
  61. enum git_attr_direction {
  62. GIT_ATTR_CHECKIN,
  63. GIT_ATTR_CHECKOUT,
  64. GIT_ATTR_INDEX
  65. };
  66. void git_attr_set_direction(enum git_attr_direction new_direction);
  67. void attr_start(void);
  68. #endif /* ATTR_H */