Commit 07e863d
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.
Commit 106b688 (rebase: ignore non-branch update-refs) filters out
decorations that are not local branches, such as HEAD and tags. A branch
symref is different: it is still a local branch decoration, but if it
resolves to another branch then that target branch is itself present in
the decoration list and will be updated as a concrete branch.
Skip branch decorations whose symrefs resolve to refs/heads/*, because
those targets are already represented by concrete branch decorations.
This prevents aliases from scheduling a second update for the same
branch.
Resolve remaining local branch decorations before checking whether they
are checked out, but only skip the current branch when it is not
reported as checked out. This preserves the existing todo-list comment
for checked-out branches while still avoiding an update-ref command for
the current branch when no checked-out protection is needed.
Symrefs to other branches are skipped directly. Other symrefs stay on
the existing path, but checked-out protection is applied to the resolved
target rather than to the symref name.
Signed-off-by: Son Luong Ngoc <sluongng@gmail.com>1 parent f60db8d commit 07e863d
2 files changed
Lines changed: 50 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6460 | 6460 | | |
6461 | 6461 | | |
6462 | 6462 | | |
6463 | | - | |
6464 | | - | |
6465 | | - | |
6466 | | - | |
6467 | | - | |
| 6463 | + | |
| 6464 | + | |
| 6465 | + | |
| 6466 | + | |
6468 | 6467 | | |
6469 | 6468 | | |
6470 | 6469 | | |
6471 | 6470 | | |
| 6471 | + | |
| 6472 | + | |
| 6473 | + | |
6472 | 6474 | | |
6473 | 6475 | | |
6474 | 6476 | | |
6475 | | - | |
6476 | | - | |
6477 | | - | |
6478 | | - | |
6479 | 6477 | | |
6480 | 6478 | | |
6481 | 6479 | | |
6482 | 6480 | | |
6483 | | - | |
6484 | | - | |
| 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 | + | |
6485 | 6506 | | |
6486 | 6507 | | |
6487 | 6508 | | |
| |||
6493 | 6514 | | |
6494 | 6515 | | |
6495 | 6516 | | |
6496 | | - | |
| 6517 | + | |
6497 | 6518 | | |
6498 | 6519 | | |
6499 | 6520 | | |
| |||
6513 | 6534 | | |
6514 | 6535 | | |
6515 | 6536 | | |
| 6537 | + | |
6516 | 6538 | | |
6517 | 6539 | | |
6518 | 6540 | | |
| 6541 | + | |
6519 | 6542 | | |
6520 | 6543 | | |
6521 | 6544 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1979 | 1979 | | |
1980 | 1980 | | |
1981 | 1981 | | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
1982 | 1986 | | |
1983 | 1987 | | |
1984 | 1988 | | |
1985 | 1989 | | |
1986 | 1990 | | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
1987 | 1994 | | |
1988 | 1995 | | |
1989 | 1996 | | |
1990 | 1997 | | |
1991 | 1998 | | |
1992 | 1999 | | |
1993 | 2000 | | |
| 2001 | + | |
1994 | 2002 | | |
1995 | 2003 | | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
1996 | 2011 | | |
1997 | 2012 | | |
1998 | 2013 | | |
| |||
0 commit comments