Skip to content

Support SHA256 Git repositories #14942

@Joshix-1

Description

@Joshix-1

View all comments

SHA256 integration status

Cargo supports three different Git backends. Here is the status for each:

libgit2

Status: Not yet integrated into Cargo — Waiting for libgit2 to cut a new v1.9 release so git2-rs can have an experimental integration to help test libgit2 sha256 support before libgit2 v2 is out.

Integration PR: #16939

gitoxide

Status: Not yet integrated into Cargo — Working in progress.

Git CLI

Status: Not yet integrated into Cargo — Already supported in Git v2. Planned to become default in v3.

To support Git CLI standalone without libgit2 support, we'll need to overhaul of our git database infra, and expose some more configs like `net.git-fetch-with-cli to switch backend. This is not desired as Git CLI is an external dependency. However, if we can't make the feature happen sooner in libgit2/gitoxide we might go down this path.

See #14942 (comment) for more about the current architecture.


below is the original issue content

Problem

cargo install --git https://codeberg.org/Joshix/rps fails

Steps

$ cargo install --git https://codeberg.org/Joshix/rps
    Updating git repository `https://codeberg.org/Joshix/rps`
error: failed to fetch into: /home/josh/.cargo/git/db/rps-7d405a448b2c5f11

Caused by:
  unknown remote object format 'sha256'; class=Invalid (3)
$ cargo +nightly -Zgitoxide install --git https://codeberg.org/Joshix/rps
    Updating git repository `https://codeberg.org/Joshix/rps`
error: failed to clone into: /home/josh/.cargo/git/db/rps-257013808e5f3c48

Caused by:
  failed to fill whole buffer
$ env CARGO_NET_GIT_FETCH_WITH_CLI=true cargo install --git https://codeberg.org/Joshix/rps
    Updating git repository `https://codeberg.org/Joshix/rps`
fatal: mismatched algorithms: client sha1; server sha256
error: failed to clone into: /home/josh/.cargo/git/db/rps-7d405a448b2c5f11

Caused by:
  process didn't exit successfully: `git fetch --force --update-head-ok 'https://codeberg.org/Joshix/rps' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)

Possible Solution(s)

Support the sha256 object format

Notes

No response

Version

cargo 1.83.0 (5ffbef321 2024-10-29)
release: 1.83.0
commit-hash: 5ffbef3211a8c378857905775a15c5b32a174d3b
commit-date: 2024-10-29
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions