-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
git clone with --filter=blob:none fails with older git clients #19118
Comments
I think we need some more verbose git client logs here. The bad pack header is coming out git itself. Now it could be that the protocol that gitea is handling over http is incorrect but it's hard to see. Would you be able to give us more verbose logs from the client? Does SSH work? |
^ SSH:
|
There was not really a old behavior ever, git would ignore it by-default unless the site administrator enabled it per-repo basis, since that commit git will be allowed to act on the filter when passed. It's not a logical situation from how I see it, a older client is passing on options which the client doesn't even support. @zeripath IIRC when partial cloning is done, git will send some information about it, it seems like because it's a older client git don't expect the data to be their and thus errors. |
Hmm telling git to don't allow partial clones will result in:
https://github.com/git/git/blob/74cc1aa55f30ed76424a0e7226ab519aa6265061/upload-pack.c#L1077 So we would need to read the request body and then filter(no pun intended) away the |
Ah yup I see that the Ubuntu Git 2.25.1 man page does not document the --filter flag. The Ubuntu Git 2.30.2 man page does document the flag. However, gitlab documentation indicates that git 2.22.0 should be sufficiently new to support the --filter option for partial clones. The upstream git documentation for partial clones seems to first show up with version 2.19.0. Based on this it isn't clear to me if the git client just doesn't support this functionality on those versions, or if the client is buggy, or if the server is doing something wrong.
When we set the Gitea option
This works well enough for us for now though we don't get to take advantage of the better performance with newer clients. |
I've just realized that I failed to neglect to mention that this worked file with Gitea v1.15.11. I think that is because the old behavior in Gitea is the same we see now with |
Also for comparison, using the same option against the same repo hosted on github works without issues and does indeed seem to make use of partial cloning, as it reports less objects transferred than without that option. |
I think we need some more verbose git client logs here. The bad pack header is coming out git itself. Now it could be that the protocol that gitea is handling over http is incorrect but it's hard to see. Would you be able to give us more verbose logs from the client? |
I'm not sure if these are the more verbose logs you are looking for but I did my best: https://gist.github.com/cboylan/ee695bfe439efc54727f93b22a0dd5c2 in particular I think lines 100-104 show where it is having problems. As a side note I'm able to reproduce this trivially using |
Thanks. That's the kind of information I was looking for - plus the reproducer info. Now it looks to me like the response is coming directly from git itself without Gitea being definitely involved. There's a part of Gitea that does some git protocol communication but I have a feeling that that isn't here. I guess we need to walk through the protocol and see where the failure is. If you're interested, here are where we handle git protocol: gitea/routers/web/repo/http.go Line 438 in e69b7a9
These are the 0000 packets we write: gitea/routers/web/repo/http.go Lines 329 to 330 in e69b7a9
gitea/routers/web/repo/http.go Lines 552 to 553 in e69b7a9
I would guess adding some checkpoints in a debugger or log statements there and elsewhere around this file might be helpful |
…der git clients Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed. Fix go-gitea#19118 Signed-off-by: Andrew Thornton <art27@cantab.net>
…der git clients (go-gitea#19430) Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed. Fix go-gitea#19118 Signed-off-by: Andrew Thornton <art27@cantab.net>
Thank you for fixing this. I had intended on trying to dig into this a bit more but ended up being distracted by other things. We've since deployed the v1.16.6 release which includes this fix, and it seems to be working for us. |
…der git clients (go-gitea#19430) Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed. Fix go-gitea#19118 Signed-off-by: Andrew Thornton <art27@cantab.net>
Gitea Version
1.16.4
Git Version
git version 2.30.2
Operating System
Debian Bullseye
How are you running Gitea?
We build our own docker images based on Debian Bullseye using Golang 1.17. We then deploy this image using docker and docker-compose.
Database
MySQL
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
Gitea 1.16 introduced support for partial clones by default in 4b3bfd7. The git client on Ubuntu Focal version 2.25.1 fails to clone repositories hosted by Gitea 1.16.4 if the --filter=blob:none flag is used. The git client included in Ubuntu Hirsute version 2.30.2 does not fail. This is a problem because some tools like pip set this flag when fetching resources from git repositories.
We are working around this by setting git.DISABLE_PARTIAL_CLONE to true in our app.ini config file.
I am not sure if this is a bug in Gitea, the version of git on our Gitea server (the version comes from Debian Bullseye and is 2.30.2), or the client version of git..
This is what it looks like reproduced against the trygitea.io site:
Even if the bug isn't in Gitea itself I think that Gitea should fall back to the old behavior of ignoring the --filter options on clone when talking to a client that cannot support this functionality.
Screenshots
No response
The text was updated successfully, but these errors were encountered: