Skip to content

git clone with --filter=blob:none fails with older git clients #19118

Closed
@cboylan

Description

@cboylan

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:

$ git clone --filter=blob:none https://try.gitea.io/karambaza/testRep
Cloning into 'testRep'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), 675 bytes | 675.00 KiB/s, done.
fatal: the remote end hung up unexpectedly
fatal: protocol error: bad pack header
warning: https unexpectedly said: '0000'
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions