git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 6/7] refs: redefine special refs

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 19, 2024, 20:28 UTC
Message-ID
<xmqq7ck5jceq.fsf@gitster.g>
In-Reply-To
<a4b4dd51f81fdf65f79b9afc3bd85109817ea128.1705659748.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
> Now that our list of special refs really only contains refs which have
> actually-special semantics, let's redefine what makes a special ref.
Yay.
Show 57 quoted lines
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  refs.c | 33 +++++++--------------------------
>  1 file changed, 7 insertions(+), 26 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 047c81b1c1..08a900a047 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1839,13 +1839,10 @@ static int refs_read_special_head(struct ref_store *ref_store,
>  static int is_special_ref(const char *refname)
>  {
>  	/*
> -	 * Special references get written and read directly via the filesystem
> -	 * by the subsystems that create them. Thus, they must not go through
> -	 * the reference backend but must instead be read directly. It is
> -	 * arguable whether this behaviour is sensible, or whether it's simply
> -	 * a leaky abstraction enabled by us only having a single reference
> -	 * backend implementation. But at least for a subset of references it
> -	 * indeed does make sense to treat them specially:
> +	 * Special references 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 special:
>  	 *
>  	 * - FETCH_HEAD may contain multiple object IDs, and each one of them
>  	 *   carries additional metadata like where it came from.
> @@ -1853,25 +1850,9 @@ static int is_special_ref(const char *refname)
>  	 * - MERGE_HEAD may contain multiple object IDs when merging multiple
>  	 *   heads.
>  	 *
> -	 * There are some exceptions that you might expect to see on this list
> -	 * but which are handled exclusively via the reference backend:
> -	 *
> -	 * - BISECT_EXPECTED_REV
> -	 *
> -	 * - CHERRY_PICK_HEAD
> -	 *
> -	 * - HEAD
> -	 *
> -	 * - ORIG_HEAD
> -	 *
> -	 * - "rebase-apply/" and "rebase-merge/" contain all of the state for
> -	 *   rebases, including some reference-like files. These are
> -	 *   exclusively read and written via the filesystem and never go
> -	 *   through the refdb.
> -	 *
> -	 * Writing or deleting references must consistently go either through
> -	 * the filesystem (special refs) or through the reference backend
> -	 * (normal ones).
> +	 * Reading, writing or deleting references must consistently go either
> +	 * through the filesystem (special refs) or through the reference
> +	 * backend (normal ones).
>  	 */
>  	static const char * const special_refs[] = {
>  		"FETCH_HEAD",
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 20 of 23 in “refs: convert special refs to become normal pseudo-refs”
  1. 0/7 refs: convert special refs to become normal pseudo-refsPatrick Steinhardt, Jan 19, 2024
  2. 1/7 sequencer: clean up pseudo refs with REF_NO_DEREFPatrick Steinhardt, Jan 19, 2024
  3. Junio C HamanoJan 19, 2024
  4. Patrick SteinhardtJan 22, 2024
  5. Karthik NayakJan 22, 2024
  6. Patrick SteinhardtJan 22, 2024
  7. 2/7 sequencer: delete REBASE_HEAD in correct repo when picking commitsPatrick Steinhardt, Jan 19, 2024
  8. 3/7 refs: convert AUTO_MERGE to become a normal pseudo-refPatrick Steinhardt, Jan 19, 2024
  9. Junio C HamanoJan 19, 2024
  10. Patrick SteinhardtJan 22, 2024
  11. Elijah NewrenJan 24, 2024
  12. Karthik NayakJan 22, 2024
  13. 4/7 sequencer: introduce functions to handle autostashes via refsPatrick Steinhardt, Jan 19, 2024
  14. Junio C HamanoJan 19, 2024
  15. Patrick SteinhardtJan 22, 2024
  16. Phillip WoodJan 22, 2024
  17. Junio C HamanoJan 22, 2024
  18. 5/7 refs: convert MERGE_AUTOSTASH to become a normal pseudo-refPatrick Steinhardt, Jan 19, 2024
  19. 6/7 refs: redefine special refsPatrick Steinhardt, Jan 19, 2024
  20. Junio C HamanoJan 19, 2024
  21. 7/7 Documentation: add "special refs" to the glossaryPatrick Steinhardt, Jan 19, 2024
  22. Phillip WoodJan 23, 2024
  23. Patrick SteinhardtJan 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.