refs: redefine special refs

Now that our list of special refs really only contains refs which have actually-special semantics, let's redefine what makes a special ref. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jan 19, 2024 at 11:40 UTC 2cd33f44282853d77bea9c29d1a4f88d8c3b3e5a
1 file changed +7 -26
refs.c
+7 -26
@@ -1839,13 +1839,10 @@ done:
1839 static int is_special_ref(const char *refname)
1840 {
1841 /*
1842 - * Special references get written and read directly via the filesystem
1843 - * by the subsystems that create them. Thus, they must not go through
1844 - * the reference backend but must instead be read directly. It is
1845 - * arguable whether this behaviour is sensible, or whether it's simply
1846 - * a leaky abstraction enabled by us only having a single reference
1847 - * backend implementation. But at least for a subset of references it
1848 - * indeed does make sense to treat them specially:
1842 + * Special references are refs that have different semantics compared
1843 + * to "normal" refs. These refs can thus not be stored in the ref
1844 + * backend, but must always be accessed via the filesystem. The
1845 + * following refs are special:
1846 *
1847 * - FETCH_HEAD may contain multiple object IDs, and each one of them
1848 * carries additional metadata like where it came from.
@@ -1853,25 +1850,9 @@ static int is_special_ref(const char *refname)
1850 * - MERGE_HEAD may contain multiple object IDs when merging multiple
1851 * heads.
1852 *
1856 - * There are some exceptions that you might expect to see on this list
1857 - * but which are handled exclusively via the reference backend:
1858 - *
1859 - * - BISECT_EXPECTED_REV
1860 - *
1861 - * - CHERRY_PICK_HEAD
1862 - *
1863 - * - HEAD
1864 - *
1865 - * - ORIG_HEAD
1866 - *
1867 - * - "rebase-apply/" and "rebase-merge/" contain all of the state for
1868 - * rebases, including some reference-like files. These are
1869 - * exclusively read and written via the filesystem and never go
1870 - * through the refdb.
1871 - *
1872 - * Writing or deleting references must consistently go either through
1873 - * the filesystem (special refs) or through the reference backend
1874 - * (normal ones).
1853 + * Reading, writing or deleting references must consistently go either
1854 + * through the filesystem (special refs) or through the reference
1855 + * backend (normal ones).
1856 */
1857 static const char * const special_refs[] = {
1858 "FETCH_HEAD",