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

Re: [PATCH 4/4] refs: do not clobber dangling symrefs

From
Jeff King <peff@peff.net>
Date
Sep 23, 2025, 17:33 UTC
Message-ID
<20250923173322.GA1136654@coredump.intra.peff.net>
In-Reply-To
<87cy7hy0gc.fsf@iotcl.com>
On Tue, Sep 23, 2025 at 11:36:51AM +0200, Toon Claes wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > So I dunno. My inclination is to say that the double-null-oid invocation
> > is weird and wrong, and callers should update if they need to. But I
> > could be convinced otherwise.
> 
> Thanks for your feedback, and I have to agree. I'll get in touch with
> the Gitaly team to see if we can rid of this odd invocation. For the
> record, this conversation has been happening here[1].
> 
> [1]: https://gitlab.com/gitlab-org/gitaly/-/merge_requests/8161#note_2767808133

Looking over that conversation, I do think you might consider using symref-delete. As noted there, doing "delete <dangling-symref>" is going to delete unconditionally, whether it's a symref, a real ref, or nothing is there at all.

If you know it's a symref pointing to "refs/heads/foo", then the safest thing is:

  symref-delete FOO_HEAD refs/heads/foo
which guarantees the operation is doing what you expected.

There's an open question there of: how do I know what it's pointing to? But that's kind of the point of the "old-target" (and "old-oid") options. They take information you discovered previously non-atomically and atomically perform the operation while checking (under lock) that things haven't changed unexpectedly.

So from the test perspective, I think you just know what's in the test fixture. From the Gitaly API perspective, the caller should have some idea of what they're deleting (just like they should for a real ref).

-Peff
Previous: Toon Claes
Message 22 of 22 in “dangling symrefs and fetchRemoteHEAD=create”
  1. 0/4 dangling symrefs and fetchRemoteHEAD=createJeff King, Aug 19, 2025
  2. Jeff KingAug 19, 2025
  3. 1/4 t5510: make confusing config cleanup more explicitJeff King, Aug 19, 2025
  4. Eric SunshineAug 19, 2025
  5. Eric SunshineAug 19, 2025
  6. Jeff KingAug 19, 2025
  7. 2/4 t5510: stop changing top-level working directoryJeff King, Aug 19, 2025
  8. 3/4 t5510: prefer "git -C" to subshell for followRemoteHEAD testsJeff King, Aug 19, 2025
  9. SZEDER GáborAug 24, 2025
  10. Junio C HamanoAug 25, 2025
  11. Jeff KingAug 26, 2025
  12. Junio C HamanoAug 26, 2025
  13. 4/4 refs: do not clobber dangling symrefsJeff King, Aug 19, 2025
  14. Patrick SteinhardtAug 20, 2025
  15. Jeff KingAug 20, 2025
  16. Toon ClaesSep 22, 2025
  17. Junio C HamanoSep 22, 2025
  18. Jeff KingSep 22, 2025
  19. Junio C HamanoSep 22, 2025
  20. Jeff KingSep 22, 2025
  21. Toon ClaesSep 23, 2025
  22. Jeff KingSep 23, 2025

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.