Closed Enselic closed 1 year ago
I know git2 is a big fat dependency. However, this is a semver-breaking change (when used with default-features=false
the functionality changes), and for now I don't want to cause churn.
Understandable. But yes, git2 a heavy dep, and it would be nice to be able to avoid it when not needed, even in the 0.19.x series.
How about making getting rid of git2 opt-in then to avoid semver problems? In other words, we can introduce a "no-git-index" feature. Then in 0.20.0 we can turn it back into being opt-out and called "git-index".
Silly me, enabling a feature can't result in the removal of a dependency.
Can we keep this PR open until it is time to bump to 0.20.0 so we don't forget about it? Please ping me then, and I'll rebase this PR on top of master. Thanks!
To adapt to the sparse crates.io index, I have stopped using the git index code from crates-index, and only use the
Crate
code, in particularCrate::from_slice
, since that works with the HTTP response of the sparse index:This means that I do not need the git2 dep at all. This PR makes the git2 dep of crates-index optional (but default).
In my project this reduces number of deps from 151 to 134 and reduces release build time from 260s to 190s, so the gain is quite substantial.
To reduce the number of
#[cfg(feature = "git-index")]
I had to add, I had to move the code around a bit, but not in a way that changes the public API:Related: #87