Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -f the default behavior for dolt fetch #4943

Closed
alecstein opened this issue Dec 7, 2022 · 6 comments · Fixed by #5311
Closed

Make -f the default behavior for dolt fetch #4943

alecstein opened this issue Dec 7, 2022 · 6 comments · Fixed by #5311
Assignees
Labels
bug Something isn't working

Comments

@alecstein
Copy link
Contributor

I get this error intermittently and have for a long time now.

dolt fetch <remote-name>

results in

Downloaded 11 chunks, 14 kB @ 5.26 kB/s.
Downloaded 5 chunks, 9.0 kB @ 5.8 kB/s.
Downloaded 8 chunks, 13 kB @ 6.82 kB/s.
error: fetch failed, can't fast forward remote tracking ref
cause: can't fast forward merge

The way to fix it has been to remove and re-add the remote. Then fetching works fine.

I can't repro because I don't know what causes it. It seems to happen randomly.

@alecstein alecstein added the bug Something isn't working label Dec 7, 2022
@druvv
Copy link
Contributor

druvv commented Dec 7, 2022

This happens when you force push a ref to the remote. Git automatically force updates refs with a warning when you fetch:

➜ docs (dhruv/test) ✔ git fetch
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 45 (delta 22), reused 14 (delta 9), pack-reused 0
Unpacking objects: 100% (45/45), 33.79 KiB | 768.00 KiB/s, done.
From github.com:dolthub/docs
 + 2c3bdd7...953812c dhruv/test      -> origin/dhruv/test  (forced update)
   05f5495..dba0656  gitbook-dev     -> origin/gitbook-dev
   78f6d91..1eae518  gitbook-publish -> origin/gitbook-publish

Not sure why we do not force update the ref. Will check with team before fixing.

@druvv
Copy link
Contributor

druvv commented Dec 7, 2022

The workaround is to use the --force flag:

dolt fetch -f

@timsehn
Copy link
Sponsor Contributor

timsehn commented Dec 7, 2022

I have also seen this.

@alecstein next time you see it, tar up the directory and put it on Google drive.

@fulghum
Copy link
Contributor

fulghum commented Dec 7, 2022

Great info and workaround from @druvv. Sounds like we should update this error message to explain what's (likely) going on and how to move forward with the --force flag.

@timsehn
Copy link
Sponsor Contributor

timsehn commented Dec 16, 2022

https://drive.google.com/file/d/10VWzRLFbxYvpwm1qbUXDhk85p-teRp3u/view?usp=sharing

Here's a link with a repo that reproduces one of these. Can we please debug?

@druvv
Copy link
Contributor

druvv commented Dec 16, 2022

Here is the repro:

mkdir remote clone1
cd clone1
dolt init
dolt sql -q "create table t (pk int primary key);"
dolt commit -Am "commit1"

dolt remote add origin file://../remote
dolt push origin main

cd ..
dolt clone file://./remote clone2

cd clone1
dolt commit --amend -m "commit1 edited"
dolt push origin main -f

cd ../clone2
dolt fetch # <- thows the can't fast forward error
dolt fetch -f # <- works

We should probably remove the -f flag from fetch and make it enabled by default.

@fulghum fulghum changed the title error: fetch failed, can't fast forward remote tracking ref Make -f the default behavior for dolt fetch Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants