Cargo-internal git clone fails where plain git clone succeeds


#1

I’m trying to specify a dependency in Cargo which lives in my own git repository, like this:

[dev-dependencies.test_data]
version = "0"
git = "https://git.enyo.de/fw/rust/test_data.git/"

But this results in an error message:

    Updating git repository `https://git.enyo.de/fw/rust/test_data.git/`
warning: spurious network error (2 tries remaining): [12/-1] No Content-Type header in response
warning: spurious network error (1 tries remaining): [12/-1] No Content-Type header in response
error: failed to load source for a dependency on `test_data`

Caused by:
  Unable to update https://git.enyo.de/fw/rust/test_data.git/

Caused by:
  failed to fetch into …/.cargo/git/db/test_data-a7b542cf32431c9f

However, git clone https://git.enyo.de/fw/rust/test_data.git/ works just fine. Any idea what is going on here?

Does Cargo come with its own git implementation which does not support the plain HTTP transport?


#2

Cargo uses libgit2, which is a separate codebase from the “normal” git binary.


#3

I have figured out how to enable the smart HTTP transport, and it works now. It seems to be a libgit2 limitation that the old/plain HTTP transport is not supported.