config --get-colorbool: diff.color is a deprecated synonym to color.diff
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 54ec98d153889f40313dba9a5ee8f07ddd0e160a..3e6e98c5eb20fc7a365d25b3abc275644b4c26f9 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -643,6 +643,37 @@ int check_ref_format(const char *ref)
        }
 }
 
+const char *ref_rev_parse_rules[] = {
+       "%.*s",
+       "refs/%.*s",
+       "refs/tags/%.*s",
+       "refs/heads/%.*s",
+       "refs/remotes/%.*s",
+       "refs/remotes/%.*s/HEAD",
+       NULL
+};
+
+const char *ref_fetch_rules[] = {
+       "%.*s",
+       "refs/%.*s",
+       "refs/heads/%.*s",
+       NULL
+};
+
+int refname_match(const char *abbrev_name, const char *full_name, const char **rules)
+{
+       const char **p;
+       const int abbrev_name_len = strlen(abbrev_name);
+
+       for (p = rules; *p; p++) {
+               if (!strcmp(full_name, mkpath(*p, abbrev_name_len, abbrev_name))) {
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+
 static struct ref_lock *verify_lock(struct ref_lock *lock,
        const unsigned char *old_sha1, int mustexist)
 {