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

Re: [PATCH 2/2] Make HEAD a PSEUDOREF rather than PER_WORKTREE.

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2020, 20:30 UTC
Message-ID
<xmqqeepo9yjb.fsf@gitster.c.googlers.com>
In-Reply-To
<470821dc6d4b72c6414b3458883277ad36952892.1594056572.git.gitgitgadget@gmail.com>
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Han-Wen Nienhuys <hanwen@google.com>
>
> This is consistent with the definition of REF_TYPE_PSEUDOREF
> (uppercase in the root ref namespace).

I wonder if some special casing we saw for "HEAD" in 1/2 (e.g. we no longer do this to pseudorefs in this codepath but HEAD is different and will continue to be dealt with in the codepath) needs adjustment after this change? HEAD still needs to be able to have a different value (either detached or pointing to another ref) per worktree, but it is unclear where that knowledge now resides in the new code. Are we declaring that all pseudorefs are per worktree (which I think is not wrong)?

Show 23 quoted lines
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  refs.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index a2fd42364f..265767a234 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -676,10 +676,9 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **log)
>  
>  static int is_per_worktree_ref(const char *refname)
>  {
> -	return !strcmp(refname, "HEAD") ||
> -		starts_with(refname, "refs/worktree/") ||
> -		starts_with(refname, "refs/bisect/") ||
> -		starts_with(refname, "refs/rewritten/");
> +	return starts_with(refname, "refs/worktree/") ||
> +	       starts_with(refname, "refs/bisect/") ||
> +	       starts_with(refname, "refs/rewritten/");
>  }
>  
>  static int is_pseudoref_syntax(const char *refname)
Previous: Han-Wen Nienhuys via GitGitGadgetNext: Han-Wen Nienhuys
Message 9 of 39 in “Remove special casing for PSEUDOREF updates”
  1. 0/2 Remove special casing for PSEUDOREF updatesHan-Wen Nienhuys via GitGitGadget, Jul 6, 2020
  2. 1/2 Modify pseudo refs through ref backend storageHan-Wen Nienhuys via GitGitGadget, Jul 6, 2020
  3. Junio C HamanoJul 6, 2020
  4. Han-Wen NienhuysJul 7, 2020
  5. Junio C HamanoJul 7, 2020
  6. Han-Wen NienhuysJul 7, 2020
  7. Junio C HamanoJul 7, 2020
  8. 2/2 Make HEAD a PSEUDOREF rather than PER_WORKTREE.Han-Wen Nienhuys via GitGitGadget, Jul 6, 2020
  9. Junio C HamanoJul 6, 2020
  10. Han-Wen NienhuysJul 7, 2020
  11. 0/3 Remove special casing for PSEUDOREF updatesHan-Wen Nienhuys via GitGitGadget, Jul 9, 2020
  12. 2/3 Modify pseudo refs through ref backend storageHan-Wen Nienhuys via GitGitGadget, Jul 9, 2020
  13. 3/3 Make HEAD a PSEUDOREF rather than PER_WORKTREE.Han-Wen Nienhuys via GitGitGadget, Jul 9, 2020
  14. 1/3 t1400: use git rev-parse for testing PSEUDOREF existenceHan-Wen Nienhuys via GitGitGadget, Jul 9, 2020
  15. Junio C HamanoJul 10, 2020
  16. 0/3 Remove special casing for PSEUDOREF updatesHan-Wen Nienhuys via GitGitGadget, Jul 16, 2020
  17. 1/3 t1400: use git rev-parse for testing PSEUDOREF existenceHan-Wen Nienhuys via GitGitGadget, Jul 16, 2020
  18. 3/3 Make HEAD a PSEUDOREF rather than PER_WORKTREE.Han-Wen Nienhuys via GitGitGadget, Jul 16, 2020
  19. 2/3 Modify pseudo refs through ref backend storageHan-Wen Nienhuys via GitGitGadget, Jul 16, 2020
  20. Johannes SchindelinJul 17, 2020
  21. Han-Wen NienhuysJul 27, 2020
  22. Junio C HamanoJul 16, 2020
  23. Han-Wen NienhuysJul 27, 2020
  24. Junio C HamanoJul 27, 2020
  25. Han-Wen NienhuysAug 3, 2020
  26. Junio C HamanoAug 3, 2020
  27. Junio C HamanoAug 5, 2020
  28. Han-Wen NienhuysAug 5, 2020
  29. Junio C HamanoAug 5, 2020
  30. Han-Wen NienhuysAug 10, 2020
  31. Junio C HamanoAug 10, 2020
  32. Han-Wen NienhuysAug 11, 2020
  33. Junio C HamanoAug 11, 2020
  34. Han-Wen NienhuysAug 19, 2020
  35. Junio C HamanoAug 19, 2020
  36. 0/3 Remove special casing for PSEUDOREF updatesHan-Wen Nienhuys via GitGitGadget, Jul 27, 2020
  37. 1/3 t1400: use git rev-parse for testing PSEUDOREF existenceHan-Wen Nienhuys via GitGitGadget, Jul 27, 2020
  38. 2/3 Modify pseudo refs through ref backend storageHan-Wen Nienhuys via GitGitGadget, Jul 27, 2020
  39. 3/3 Make HEAD a PSEUDOREF rather than PER_WORKTREE.Han-Wen Nienhuys via GitGitGadget, Jul 27, 2020

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.