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

Re: [PATCH v2 5/6] builtin/remote: rework how remote refs get renamed

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 4, 2025, 06:54 UTC
Message-ID
<aJBZL9B4foXZW-ix@pks.im>
In-Reply-To
<20250802104533.GA1180347@coredump.intra.peff.net>
On Sat, Aug 02, 2025 at 06:45:33AM -0400, Jeff King wrote:
Show 25 quoted lines
> On Thu, Jul 31, 2025 at 04:56:53PM +0200, Patrick Steinhardt wrote:
> 
> > There is one issue though with using atomic transactions: when nesting a
> > remote into itself it can happen that renamed references conflict with
> > the old referencse. For example, when we have a reference
> > "refs/remotes/origin/foo" and we rename "origin" to "origin/foo", then
> > we'll end up with an F/D conflict when we try to create the renamed
> > reference "refs/remotes/origin/foo/foo".
> 
> I think that was true even in the old code. E.g., if I do:
> 
>   git init server
>   git -C server commit --allow-empty -m foo
>   git -C server branch a
>   git -C server branch b
> 
>   git init
>   git remote add foo/b server
>   git fetch
>   git remote rename foo/b foo
> 
> then I get (before your patches):
> 
>   error: 'refs/remotes/foo/b/main' exists; cannot create 'refs/remotes/foo/b'
>   fatal: renaming 'refs/remotes/foo/b/b' failed

The test case I have added for this conflicting case only fails with the postimage of this series. So we hit some _new_ edge cases now that didn't exist before, but I think that's acceptable.

> Worse, we moved "a" but not "b" (nor "main"/"master", which are
> important because they are what's blocking the rename of "b"). So we are
> left with a broken half-moved state.
Yes, this half-applied state is quite awful.
> After your patches we get a nicer hint message, and of course we retain
> the unbroken state from prior to the rename. So IMHO it is strictly
> better.
Patrick
Previous: Jeff KingNext: Patrick Steinhardt
Message 31 of 37 in “builtin/remote: rework how remote refs get renamed”
  1. 0/4 builtin/remote: rework how remote refs get renamedPatrick Steinhardt, Jul 28, 2025
  2. 1/4 refs: pass refname when invoking reflog entry callbackPatrick Steinhardt, Jul 28, 2025
  3. Justin ToblerJul 28, 2025
  4. Junio C HamanoJul 28, 2025
  5. Karthik NayakJul 29, 2025
  6. Patrick SteinhardtJul 31, 2025
  7. 2/4 refs: simplify logic when migrating reflog entriesPatrick Steinhardt, Jul 28, 2025
  8. Justin ToblerJul 28, 2025
  9. Junio C HamanoJul 28, 2025
  10. 3/4 builtin/remote: rework how remote refs get renamedPatrick Steinhardt, Jul 28, 2025
  11. Junio C HamanoJul 28, 2025
  12. Patrick SteinhardtJul 29, 2025
  13. Justin ToblerJul 28, 2025
  14. Junio C HamanoJul 28, 2025
  15. Patrick SteinhardtJul 29, 2025
  16. Jeff KingJul 29, 2025
  17. Patrick SteinhardtJul 29, 2025
  18. Jeff KingAug 2, 2025
  19. 4/4 builtin/remote: only iterate through refs that are to be renamedPatrick Steinhardt, Jul 28, 2025
  20. Junio C HamanoJul 28, 2025
  21. Karthik NayakJul 30, 2025
  22. Patrick SteinhardtJul 31, 2025
  23. Junio C HamanoJul 28, 2025
  24. 0/6 builtin/remote: rework how remote refs get renamedPatrick Steinhardt, Jul 31, 2025
  25. 1/6 refs: pass refname when invoking reflog entry callbackPatrick Steinhardt, Jul 31, 2025
  26. 2/6 refs: simplify logic when migrating reflog entriesPatrick Steinhardt, Jul 31, 2025
  27. 3/6 builtin/remote: fix sign comparison warningsPatrick Steinhardt, Jul 31, 2025
  28. 4/6 builtin/remote: determine whether refs need renaming early onPatrick Steinhardt, Jul 31, 2025
  29. 5/6 builtin/remote: rework how remote refs get renamedPatrick Steinhardt, Jul 31, 2025
  30. Jeff KingAug 2, 2025
  31. Patrick SteinhardtAug 4, 2025
  32. 6/6 builtin/remote: only iterate through refs that are to be renamedPatrick Steinhardt, Jul 31, 2025
  33. Junio C HamanoJul 31, 2025
  34. Patrick SteinhardtAug 1, 2025
  35. Junio C HamanoAug 1, 2025
  36. Patrick SteinhardtAug 4, 2025
  37. Junio C HamanoAug 4, 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.