Commit c1e8828
committed
rebase: skip branch symref aliases
git rebase --update-refs can fail after the normal rebase path has
updated the current branch when another local branch is a symref to it.
This can happen during a default-branch rename where refs/heads/main
points at refs/heads/master while users migrate.
The sequencer queues update-ref commands from local branch decorations.
It already filters out decorations that are not local branches, but a
branch symref is still a local branch decoration. Queuing the alias by
its literal name makes the final update dereference it back to the
current branch and fail the old-OID check because that branch moved
earlier in the rebase.
Resolve local branch symrefs to their referents before queuing
update-ref commands. Skip aliases of HEAD and duplicate referents,
leaving one old-OID-checked update for each concrete branch.
Signed-off-by: Son Luong Ngoc <sluongng@gmail.com>1 parent c69baaf commit c1e8828
2 files changed
Lines changed: 77 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6445 | 6445 | | |
6446 | 6446 | | |
6447 | 6447 | | |
6448 | | - | |
6449 | | - | |
| 6448 | + | |
| 6449 | + | |
6450 | 6450 | | |
6451 | | - | |
6452 | | - | |
| 6451 | + | |
| 6452 | + | |
| 6453 | + | |
| 6454 | + | |
| 6455 | + | |
6453 | 6456 | | |
6454 | 6457 | | |
6455 | 6458 | | |
6456 | 6459 | | |
| 6460 | + | |
| 6461 | + | |
| 6462 | + | |
| 6463 | + | |
6457 | 6464 | | |
6458 | 6465 | | |
6459 | 6466 | | |
6460 | 6467 | | |
6461 | 6468 | | |
6462 | 6469 | | |
6463 | 6470 | | |
| 6471 | + | |
| 6472 | + | |
| 6473 | + | |
| 6474 | + | |
| 6475 | + | |
6464 | 6476 | | |
6465 | 6477 | | |
6466 | 6478 | | |
6467 | 6479 | | |
6468 | | - | |
6469 | | - | |
| 6480 | + | |
| 6481 | + | |
| 6482 | + | |
| 6483 | + | |
| 6484 | + | |
| 6485 | + | |
| 6486 | + | |
| 6487 | + | |
| 6488 | + | |
| 6489 | + | |
| 6490 | + | |
| 6491 | + | |
| 6492 | + | |
| 6493 | + | |
| 6494 | + | |
| 6495 | + | |
| 6496 | + | |
| 6497 | + | |
| 6498 | + | |
| 6499 | + | |
| 6500 | + | |
| 6501 | + | |
| 6502 | + | |
| 6503 | + | |
| 6504 | + | |
| 6505 | + | |
| 6506 | + | |
| 6507 | + | |
| 6508 | + | |
6470 | 6509 | | |
6471 | 6510 | | |
6472 | 6511 | | |
| |||
6478 | 6517 | | |
6479 | 6518 | | |
6480 | 6519 | | |
6481 | | - | |
| 6520 | + | |
6482 | 6521 | | |
6483 | 6522 | | |
6484 | 6523 | | |
6485 | | - | |
| 6524 | + | |
6486 | 6525 | | |
6487 | 6526 | | |
6488 | 6527 | | |
6489 | | - | |
| 6528 | + | |
6490 | 6529 | | |
6491 | 6530 | | |
6492 | | - | |
6493 | | - | |
| 6531 | + | |
| 6532 | + | |
6494 | 6533 | | |
6495 | 6534 | | |
6496 | 6535 | | |
| |||
6501 | 6540 | | |
6502 | 6541 | | |
6503 | 6542 | | |
| 6543 | + | |
| 6544 | + | |
6504 | 6545 | | |
6505 | 6546 | | |
6506 | 6547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1978 | 1978 | | |
1979 | 1979 | | |
1980 | 1980 | | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
1981 | 2006 | | |
1982 | 2007 | | |
1983 | 2008 | | |
| |||
0 commit comments