dolt push
may be overly aggressive in its fast-forward check.
#7448
Labels
dolt push
may be overly aggressive in its fast-forward check.
#7448
Dolt push currently runs a fast-forward branch check against the local tracking reference to the remote branch before it goes ahead with the push attempt. This means that if the local tracking reference is stale, you can get a failure. This can really come up if the remote branch has been deleted.
For example, consider the following:
First, make a remote with a
main
and analt
branch, with your repo tracking both:mkdir repo cd repo dolt init dolt remote add origin file://../remote dolt push origin main:main dolt checkout -b alt dolt commit -m new --allow-empty dolt push origin alt:alt
Then, merge the
alt
branch tomain
, push it tomain
, and delete thealt
branch from the remote:Then go back to the original repo, create a new branch
alt
HEAD off ofmain
, and attempt to push that to the remotealt
:cd ../repo dolt checkout main dolt checkout -B alt dolt commit -m another --allow-empty dolt push origin alt:alt
At that point, you will get a rejected push:
Ways to fix include:
dolt push -f alt:alt
or running
dolt fetch -p origin
before you push.
It's not clear to me to what degree we should be using the local tracking branch state for this fast-forward check.
The text was updated successfully, but these errors were encountered: