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

Re: [PATCH v2 2/6] Documentation/git-update-ref.txt: remove safety paragraphs

From
karthik nayak <karthik.188@gmail.com>
Date
Oct 20, 2024, 11:13 UTC
Message-ID
<CAOLa=ZRAGmgfSHjAx6-1q9qV-aJ_Ciw=RZ6kpygqbSO+yAUEeg@mail.gmail.com>
In-Reply-To
<71d1e6364a21767a8d80c96a30282e6557fec426.1729367469.git.code@khaugsbakk.name>
kristofferhaugsbakk@fastmail.com writes:
Show 49 quoted lines
> From: Kristoffer Haugsbakk <code@khaugsbakk.name>
>
> Remove paragraphs which explain that using this command is safer than
> echoing the branch name into `HEAD`.
>
> These paragraphs have been part of the documentation since the
> documentation was created in 129056370ab (Add missing documentation.,
> 2005-10-04), back when the command synopsis was a lot simpler:
>
>     `git-update-ref` <ref> <newvalue> [<oldvalue>]
>
> These paragraphs don’t interrupt the flow of the document on that
> revision since it is at the end.  Now though it is placed after the
> description of `--no-deref` and before `-d` and `--stdin`.  Covering all
> the options is more generally interesting than a safety note about a
> naïve `HEAD` management.
>
> Such a safety warning is also much less relevant now, considering that
> everyone who isn’t intentionally poking at the internal implementation
> is using porcelain commands to manage `HEAD`.
>
> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
> ---
>  Documentation/git-update-ref.txt | 15 ---------------
>  1 file changed, 15 deletions(-)
>
> diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt
> index fe5967234e9..ec268b1426d 100644
> --- a/Documentation/git-update-ref.txt
> +++ b/Documentation/git-update-ref.txt
> @@ -40,21 +40,6 @@ somewhere else with a regular filename).
>  If --no-deref is given, <ref> itself is overwritten, rather than
>  the result of following the symbolic pointers.
>
> -In general, using
> -
> -	git update-ref HEAD "$head"
> -
> -should be a _lot_ safer than doing
> -
> -	echo "$head" > "$GIT_DIR/HEAD"
> -
> -both from a symlink following standpoint *and* an error checking
> -standpoint.  The "refs/" rule for symlinks means that symlinks
> -that point to "outside" the tree are safe: they'll be followed
> -for reading but not for writing (so we'll never write through a
> -ref symlink to some other tree, if you have copied a whole
> -archive by creating a symlink tree).
> -

In the new reftable backend, HEAD would simply exist as a placeholder. So either we do as you did and remove this entirely or double down to say that writing to HEAD directly is not supported. I don't have a preference here, so this looks good!

Previous: kristofferhaugsbakk@fastmail.comNext: Kristoffer Haugsbakk
Message 38 of 54 in “ref: with git update-ref?”
  1. Bence FerdinandyOct 11, 2024
  2. Kristoffer HaugsbakkOct 11, 2024
  3. Bence FerdinandyOct 11, 2024
  4. Junio C HamanoOct 11, 2024
  5. Bence FerdinandyOct 12, 2024
  6. Phillip WoodOct 13, 2024
  7. Kristoffer HaugsbakkOct 13, 2024
  8. karthik nayakOct 13, 2024
  9. Kristoffer HaugsbakkOct 13, 2024
  10. Bence FerdinandyOct 13, 2024
  11. Kristoffer HaugsbakkOct 14, 2024
  12. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  13. 1/6 doc: update-ref: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 15, 2024
  14. Taylor BlauOct 16, 2024
  15. Eric SunshineOct 16, 2024
  16. Taylor BlauOct 16, 2024
  17. Kristoffer HaugsbakkOct 17, 2024
  18. Eric SunshineOct 17, 2024
  19. Taylor BlauOct 17, 2024
  20. 2/6 doc: update-ref: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  21. Taylor BlauOct 16, 2024
  22. 3/6 doc: update-ref: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  23. 4/6 doc: update-ref: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  24. Taylor BlauOct 16, 2024
  25. Kristoffer HaugsbakkOct 16, 2024
  26. Taylor BlauOct 16, 2024
  27. 5/6 doc: update-ref: discuss symbolic linkskristofferhaugsbakk@fastmail.com, Oct 15, 2024
  28. Kristoffer HaugsbakkOct 15, 2024
  29. Taylor BlauOct 16, 2024
  30. 6/6 doc: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 15, 2024
  31. Bence FerdinandyOct 16, 2024
  32. Taylor BlauOct 16, 2024
  33. Kristoffer HaugsbakkOct 16, 2024
  34. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  35. 1/6 Documentation/git-update-ref.txt: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 19, 2024
  36. karthik nayakOct 20, 2024
  37. 2/6 Documentation/git-update-ref.txt: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  38. karthik nayakOct 20, 2024
  39. Kristoffer HaugsbakkOct 20, 2024
  40. Kristoffer HaugsbakkOct 20, 2024
  41. 3/6 Documentation/git-update-ref.txt: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  42. 4/6 Documentation/git-update-ref.txt: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  43. 5/6 Documentation/git-update-ref.txt: discuss symbolic refskristofferhaugsbakk@fastmail.com, Oct 19, 2024
  44. 6/6 Documentation: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 19, 2024
  45. karthik nayakOct 20, 2024
  46. 0/6 doc: update-ref: amend old material and discuss symrefskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  47. 1/6 Documentation/git-update-ref.txt: drop “flag”kristofferhaugsbakk@fastmail.com, Oct 21, 2024
  48. 2/6 Documentation/git-update-ref.txt: remove safety paragraphskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  49. 3/6 Documentation/git-update-ref.txt: demote symlink to last sectionkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  50. 4/6 Documentation/git-update-ref.txt: remove confusing paragraphkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  51. 5/6 Documentation/git-update-ref.txt: discuss symbolic refskristofferhaugsbakk@fastmail.com, Oct 21, 2024
  52. 6/6 Documentation: mutually link update-ref and symbolic-refkristofferhaugsbakk@fastmail.com, Oct 21, 2024
  53. Taylor BlauOct 21, 2024
  54. Andreas SchwabOct 12, 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.