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

fatal: couldn't find remote ref HEAD on recent versions #1332

Closed
lnicola opened this issue May 17, 2024 · 10 comments
Closed

fatal: couldn't find remote ref HEAD on recent versions #1332

lnicola opened this issue May 17, 2024 · 10 comments

Comments

@lnicola
Copy link

lnicola commented May 17, 2024

Note: the rm .git command below will break your repository, make sure to use an empty one.

# r23.12.04
$ josh-proxy --local ~/.cache/rust-analyzer-josh/ --remote https://github.com --port 42042 --no-background

$ mkdir foo; cd foo
$ git init
$ git fetch "http://localhost:42042/rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git"
# does stuff

# clean up a little
$ rm -rf ~/.cache/rust-analyzer-josh/ # need to clear the cache, otherwise it works
# $ rm -rf .git; git init # you can do this to start from scratch, but it's not needed

# b28d490d1683ff8ad5b63333f692ee15f603139c, but also before #1329
$ josh-proxy --local ~/.cache/rust-analyzer-josh/ --remote https://github.com --port 42042 --no-background

$ git fetch "http://localhost:42042/rust-lang/rust.git@97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git"
fatal: couldn't find remote ref HEAD

CC rust-lang/rust-analyzer#17025 (comment), @RalfJung.

I'm running it there in my RA clone, but it still seems to reproduce in an empty repository.

@RalfJung
Copy link
Contributor

rm -rf .git ~/.cache/rust-analyzer-josh/

Can you please remove the .git from this? These are very dangerous commands you are giving us here. I just deleted the .git folder of my josh checkout...

@RalfJung
Copy link
Contributor

I can confirm, this reproduces here.
It seems to have to do with the @97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f syntax, when I remove that part it works.

git fetch "http://localhost:42042/rust-lang/rust.git:rev(55d9a533b309119c8acd13061581b43ae8840823:prefix=src/tools/rust-analyzer):/src/tools/rust-analyzer.git"

But we need to know which upstream commit we fetched from so that syntax is required for us.

@RalfJung
Copy link
Contributor

Curiously, after running the command without the @..., then the command with @... also succeeds.

@lnicola
Copy link
Author

lnicola commented May 17, 2024

Sorry for that, I added a note at the top.

@RalfJung
Copy link
Contributor

Clearing .git is entirely irrelevant to reproduce the problem, you can fetch into any repo. So IMO it'd be better to just remove that part.

@RalfJung
Copy link
Contributor

I would also recommend adding --no-background to the josh invocation as otherwise josh does $STUFF in the background, which makes it "immune" to Ctrl-C and also may affect the issue.

@RalfJung
Copy link
Contributor

A bisect points at

a22ab2a29699085ad7b0813fd077cb9b73348aa8 is the first bad commit
commit a22ab2a29699085ad7b0813fd077cb9b73348aa8
Author: Christian Schilling <christian.schilling.de@gmail.com>
Date:   Wed Feb 21 17:40:08 2024 +0100

    Don't forward fetches with sha in want (#1313)
    
    Most upstreams don't support this, so it only ever worked
    when the commit was fetched before.
    
    Change: no-sha-want

Cc #1313 @christian-schilling

This has in fact worked properly before at least with github as the remote, so the "it only ever worked" part isn't true.

@christian-schilling
Copy link
Member

I'm going to revert #1313 (#1333) it causes more problems than it fixed.

@RalfJung
Copy link
Contributor

RalfJung commented May 17, 2024 via email

@lnicola
Copy link
Author

lnicola commented May 18, 2024

Fixed in #1333, thanks!

@lnicola lnicola closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants