starts_with(refname, "refs/rewritten/");
}
+static int is_pseudo_ref(const char *refname)
+{
+ /*
+ * Pseudorefs are refs that have different semantics compared to
+ * "normal" refs. These refs can thus not be stored in the ref backend,
+ * but must always be accessed via the filesystem. The following refs
+ * are pseudorefs:
+ *
+ * - FETCH_HEAD may contain multiple object IDs, and each one of them
+ * carries additional metadata like where it came from.
+ *
+ * - MERGE_HEAD may contain multiple object IDs when merging multiple
+ * heads.
+ *
+ * Reading, writing or deleting references must consistently go either
+ * through the filesystem (pseudorefs) or through the reference
+ * backend (normal ones).
+ */
+ static const char * const pseudo_refs[] = {
+ "FETCH_HEAD",
+ "MERGE_HEAD",
+ };
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(pseudo_refs); i++)
+ if (!strcmp(refname, pseudo_refs[i]))
+ return 1;
+
+ return 0;
+}
+
static int is_root_ref_syntax(const char *refname)
{
const char *c;
};
size_t i;
- if (!is_root_ref_syntax(refname))
+ if (!is_root_ref_syntax(refname) ||
+ is_pseudo_ref(refname))
return 0;
if (ends_with(refname, "_HEAD"))
return result;
}
-static int is_pseudo_ref(const char *refname)
-{
- /*
- * Pseudorefs are refs that have different semantics compared to
- * "normal" refs. These refs can thus not be stored in the ref backend,
- * but must always be accessed via the filesystem. The following refs
- * are pseudorefs:
- *
- * - FETCH_HEAD may contain multiple object IDs, and each one of them
- * carries additional metadata like where it came from.
- *
- * - MERGE_HEAD may contain multiple object IDs when merging multiple
- * heads.
- *
- * Reading, writing or deleting references must consistently go either
- * through the filesystem (pseudorefs) or through the reference
- * backend (normal ones).
- */
- static const char * const pseudo_refs[] = {
- "FETCH_HEAD",
- "MERGE_HEAD",
- };
- size_t i;
-
- for (i = 0; i < ARRAY_SIZE(pseudo_refs); i++)
- if (!strcmp(refname, pseudo_refs[i]))
- return 1;
-
- return 0;
-}
-
int refs_read_raw_ref(struct ref_store *ref_store, const char *refname,
struct object_id *oid, struct strbuf *referent,
unsigned int *type, int *failure_errno)