summaryrefslogtreecommitdiffstats
path: root/refs.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-05-23 18:14:32 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-23 18:14:32 +0200
commit0ff6d23a0f214ea19b2b26a6ab81fb02fefbea6d (patch)
treed32ccf7db553b2d8d828a961de9d1acc9f06ca00 /refs.h
parentMerge branch 'ps/refs-without-the-repository-updates' into ps/ref-storage-mig... (diff)
parentrefs: refuse to write pseudorefs (diff)
downloadgit-0ff6d23a0f214ea19b2b26a6ab81fb02fefbea6d.tar.xz
git-0ff6d23a0f214ea19b2b26a6ab81fb02fefbea6d.zip
Merge branch 'ps/pseudo-ref-terminology' into ps/ref-storage-migration
* ps/pseudo-ref-terminology: refs: refuse to write pseudorefs ref-filter: properly distinuish pseudo and root refs refs: pseudorefs are no refs refs: classify HEAD as a root ref refs: do not check ref existence in `is_root_ref()` refs: rename `is_special_ref()` to `is_pseudo_ref()` refs: rename `is_pseudoref()` to `is_root_ref()` Documentation/glossary: define root refs as refs Documentation/glossary: clarify limitations of pseudorefs Documentation/glossary: redefine pseudorefs as special refs
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h48
1 files changed, 46 insertions, 2 deletions
diff --git a/refs.h b/refs.h
index b230cc89d1..fe7f0db35e 100644
--- a/refs.h
+++ b/refs.h
@@ -1006,8 +1006,52 @@ extern struct ref_namespace_info ref_namespace[NAMESPACE__COUNT];
*/
void update_ref_namespace(enum ref_namespace namespace, char *ref);
-int is_pseudoref(struct ref_store *refs, const char *refname);
-int is_headref(struct ref_store *refs, const char *refname);
+/*
+ * Check whether the provided name names a root reference. This function only
+ * performs a syntactic check.
+ *
+ * A root ref is a reference that lives in the root of the reference hierarchy.
+ * These references must conform to special syntax:
+ *
+ * - Their name must be all-uppercase or underscores ("_").
+ *
+ * - Their name must end with "_HEAD". As a special rule, "HEAD" is a root
+ * ref, as well.
+ *
+ * - Their name may not contain a slash.
+ *
+ * There is a special set of irregular root refs that exist due to historic
+ * reasons, only. This list shall not be expanded in the future:
+ *
+ * - AUTO_MERGE
+ *
+ * - BISECT_EXPECTED_REV
+ *
+ * - NOTES_MERGE_PARTIAL
+ *
+ * - NOTES_MERGE_REF
+ *
+ * - MERGE_AUTOSTASH
+ */
+int is_root_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).
+ */
+int is_pseudo_ref(const char *refname);
/*
* The following functions have been removed in Git v2.45 in favor of functions