Skip to content

Add vendored feature #739

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

Merged
merged 1 commit into from
Aug 27, 2021
Merged

Add vendored feature #739

merged 1 commit into from
Aug 27, 2021

Conversation

arxanas
Copy link
Contributor

@arxanas arxanas commented Aug 23, 2021

As per #721, some consumers may
prefer to build libgit2 themselves to simplify distribution.

To test the vendored version, you can run:

cargo build --features vendored-libgit2`

That being said, the test branch::tests::name_is_valid fails on macOS. This
test is currently broken as per
#721 (comment)

As per rust-lang#721, some consumers may
prefer to build `libgit2` themselves to simplify distribution.

To test the vendored version, you can run:

```
cargo build --features vendored-libgit2`
```

That being said, the test `branch::tests::name_is_valid` fails on macOS. This
test is currently broken as per
rust-lang#721 (comment)
@alexcrichton
Copy link
Member

Personally I think this is a case where the burden of getting things working shouldn't be placed on the contributor but rather this crate itself. If libgit2 is stable enough that there's different versions in the wild that we're using, then the API of this crate should be adapted when using an older version or the system version should be rejected if it isn't new enough.

@arxanas
Copy link
Contributor Author

arxanas commented Aug 24, 2021

the burden of getting things working shouldn't be placed on the contributor

Who do you mean by the "contributor" in this case? The prospective contributor to git2-rs, or to libgit2? I don't follow how adding a vendored feature affects either of those parties.

the API of this crate should be adapted when using an older version or the system version should be rejected if it isn't new enough

Whose use-case is this helping? I guess you mean for people writing libraries on top of git2-rs, who would prefer to integrate with the system libgit2 if available?

In the case of end-user applications like my https://github.com/arxanas/git-branchless or @extrawurst's https://github.com/extrawurst/gitui, I think we would like to have an option where we can significantly simplify the distribution/compilation for our users who aren't consuming our applications via package manager, such as when compiling from source or downloading an executable directly from Github Releases.

@alexcrichton
Copy link
Member

Sorry by contributor I actually mean the opposite, rather users of the crate (it's early here...). I'd prefer to not burden users with the choice of how to build the native library and improve the detection at build time.

Another option though would be to use an env var instead, I don't think features work out great for a build option like this because features are part of the crate graph and this is more of a build-time concern.

@kim
Copy link
Contributor

kim commented Aug 26, 2021

Just as a data point: we needed to use a patched version of libgit2, but were bitten by the fact that git2 currently prefers the system libgit2 if it finds it. We ended up enabling the zlib-ng feature to force the vendored version.

So, as a user, I would’ve been less surprised by a feature named as proposed here.

@alexcrichton
Copy link
Member

Ok let's just add this in then.

@alexcrichton alexcrichton merged commit 97091c3 into rust-lang:master Aug 27, 2021
@arxanas arxanas deleted the vendored branch August 27, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants