Commit 2b0dfbf
committed
rebase: skip branch symref aliases
git rebase --update-refs can finish rewriting the current branch and
then fail while updating a local branch that is a symbolic ref. This can
happen during a default-branch rename where refs/heads/main points at
refs/heads/master while users migrate.
Fix this because the post-rebase failure leaves refs partially updated
even though the main rebase has succeeded.
The sequencer queues updates from local branch decorations. Commit
106b688 (rebase: ignore non-branch update-refs) filters out
decorations such as HEAD and tags. A branch symref is still a local
branch decoration, but refs_update_ref() dereferences it, so an alias to
another branch duplicates the concrete branch update.
Resolve local branch decorations before queuing them. Skip symrefs whose
referents are under refs/heads/. Keep an owned copy of the resolved HEAD
and skip the current branch before checked-out handling so later ref
resolution cannot change the comparison.
This prevents a successful rebase from being followed by a failed,
partially applied ref update while preserving each alias as a symref.
Signed-off-by: Son Luong Ngoc <sluongng@gmail.com>1 parent 48bbf81 commit 2b0dfbf
3 files changed
Lines changed: 49 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6465 | 6465 | | |
6466 | 6466 | | |
6467 | 6467 | | |
6468 | | - | |
6469 | | - | |
6470 | | - | |
6471 | | - | |
6472 | | - | |
| 6468 | + | |
| 6469 | + | |
| 6470 | + | |
| 6471 | + | |
6473 | 6472 | | |
6474 | 6473 | | |
6475 | 6474 | | |
6476 | 6475 | | |
| 6476 | + | |
| 6477 | + | |
6477 | 6478 | | |
6478 | 6479 | | |
6479 | 6480 | | |
6480 | | - | |
6481 | | - | |
6482 | | - | |
6483 | | - | |
6484 | 6481 | | |
6485 | 6482 | | |
6486 | 6483 | | |
6487 | 6484 | | |
6488 | | - | |
6489 | | - | |
| 6485 | + | |
| 6486 | + | |
| 6487 | + | |
| 6488 | + | |
| 6489 | + | |
| 6490 | + | |
| 6491 | + | |
| 6492 | + | |
| 6493 | + | |
| 6494 | + | |
| 6495 | + | |
| 6496 | + | |
| 6497 | + | |
| 6498 | + | |
| 6499 | + | |
| 6500 | + | |
| 6501 | + | |
| 6502 | + | |
| 6503 | + | |
| 6504 | + | |
| 6505 | + | |
6490 | 6506 | | |
6491 | 6507 | | |
6492 | 6508 | | |
6493 | 6509 | | |
| 6510 | + | |
| 6511 | + | |
6494 | 6512 | | |
6495 | 6513 | | |
6496 | 6514 | | |
6497 | 6515 | | |
6498 | 6516 | | |
6499 | 6517 | | |
6500 | 6518 | | |
6501 | | - | |
| 6519 | + | |
6502 | 6520 | | |
6503 | 6521 | | |
6504 | 6522 | | |
| |||
6518 | 6536 | | |
6519 | 6537 | | |
6520 | 6538 | | |
| 6539 | + | |
6521 | 6540 | | |
6522 | 6541 | | |
6523 | 6542 | | |
| 6543 | + | |
6524 | 6544 | | |
6525 | 6545 | | |
6526 | 6546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1975 | 1975 | | |
1976 | 1976 | | |
1977 | 1977 | | |
| 1978 | + | |
1978 | 1979 | | |
1979 | 1980 | | |
1980 | 1981 | | |
1981 | 1982 | | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
1982 | 1987 | | |
1983 | 1988 | | |
1984 | 1989 | | |
1985 | 1990 | | |
1986 | 1991 | | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
1987 | 1995 | | |
1988 | 1996 | | |
1989 | 1997 | | |
1990 | 1998 | | |
1991 | 1999 | | |
1992 | 2000 | | |
1993 | 2001 | | |
| 2002 | + | |
1994 | 2003 | | |
1995 | 2004 | | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
1996 | 2012 | | |
1997 | 2013 | | |
1998 | 2014 | | |
| |||
0 commit comments