X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=refs.h;h=e4578856d7c2425ac26df025e1027198f9cb63a5;hb=98ac34b2b1968e16fbf7f6122a53b73c6caaff49;hp=dfb086e93346aa3fb6f600b2ed07b5736716bf9c;hpb=d0b46502de2893a121427b94321a2bfc8cffde27;p=git.git diff --git a/refs.h b/refs.h index dfb086e93..e4578856d 100644 --- a/refs.h +++ b/refs.h @@ -10,8 +10,9 @@ struct ref_lock { int force_write; }; -#define REF_ISSYMREF 01 -#define REF_ISPACKED 02 +#define REF_ISSYMREF 0x01 +#define REF_ISPACKED 0x02 +#define REF_ISBROKEN 0x04 /* * Calls the specified function for each ref file until it returns nonzero, @@ -97,11 +98,22 @@ int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long, voi */ extern int for_each_reflog(each_ref_fn, void *); -#define CHECK_REF_FORMAT_OK 0 -#define CHECK_REF_FORMAT_ERROR (-1) -#define CHECK_REF_FORMAT_ONELEVEL (-2) -#define CHECK_REF_FORMAT_WILDCARD (-3) -extern int check_ref_format(const char *target); +#define REFNAME_ALLOW_ONELEVEL 1 +#define REFNAME_REFSPEC_PATTERN 2 +#define REFNAME_DOT_COMPONENT 4 + +/* + * Return 0 iff ref has the correct format for a refname according to + * the rules described in Documentation/git-check-ref-format.txt. If + * REFNAME_ALLOW_ONELEVEL is set in flags, then accept one-level + * reference names. If REFNAME_REFSPEC_PATTERN is set in flags, then + * allow a "*" wildcard character in place of one of the name + * components. No leading or repeated slashes are accepted. If + * REFNAME_DOT_COMPONENT is set in flags, then allow refname + * components to start with "." (but not a whole component equal to + * "." or ".."). + */ +extern int check_refname_format(const char *ref, int flags); extern const char *prettify_refname(const char *refname); extern char *shorten_unambiguous_ref(const char *ref, int strict);