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.

72 lines
2.1KB

  1. #ifndef REFSPEC_H
  2. #define REFSPEC_H
  3. #define TAG_REFSPEC "refs/tags/*:refs/tags/*"
  4. extern const struct refspec_item *tag_refspec;
  5. struct refspec_item {
  6. unsigned force : 1;
  7. unsigned pattern : 1;
  8. unsigned matching : 1;
  9. unsigned exact_sha1 : 1;
  10. char *src;
  11. char *dst;
  12. };
  13. #define REFSPEC_FETCH 1
  14. #define REFSPEC_PUSH 0
  15. #define REFSPEC_INIT_FETCH { .fetch = REFSPEC_FETCH }
  16. #define REFSPEC_INIT_PUSH { .fetch = REFSPEC_PUSH }
  17. /**
  18. * A struct refspec holds the parsed interpretation of a refspec. If it will
  19. * force updates (starts with a '+'), force is true. If it is a pattern
  20. * (sides end with '*') pattern is true. src and dest are the two sides
  21. * (including '*' characters if present); if there is only one side, it is src,
  22. * and dst is NULL; if sides exist but are empty (i.e., the refspec either
  23. * starts or ends with ':'), the corresponding side is "".
  24. *
  25. * An array of strings can be parsed into an array of struct refspecs using
  26. * parse_fetch_refspec() or parse_push_refspec().
  27. *
  28. * remote_find_tracking(), given a remote and a struct refspec with either src
  29. * or dst filled out, will fill out the other such that the result is in the
  30. * "fetch" specification for the remote (note that this evaluates patterns and
  31. * returns a single result).
  32. */
  33. struct refspec {
  34. struct refspec_item *items;
  35. int alloc;
  36. int nr;
  37. const char **raw;
  38. int raw_alloc;
  39. int raw_nr;
  40. int fetch;
  41. };
  42. int refspec_item_init(struct refspec_item *item, const char *refspec,
  43. int fetch);
  44. void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
  45. int fetch);
  46. void refspec_item_clear(struct refspec_item *item);
  47. void refspec_init(struct refspec *rs, int fetch);
  48. void refspec_append(struct refspec *rs, const char *refspec);
  49. void refspec_appendn(struct refspec *rs, const char **refspecs, int nr);
  50. void refspec_clear(struct refspec *rs);
  51. int valid_fetch_refspec(const char *refspec);
  52. struct argv_array;
  53. /*
  54. * Determine what <prefix> values to pass to the peer in ref-prefix lines
  55. * (see Documentation/technical/protocol-v2.txt).
  56. */
  57. void refspec_ref_prefixes(const struct refspec *rs,
  58. struct argv_array *ref_prefixes);
  59. #endif /* REFSPEC_H */