Skip to content
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

Update git2 to 0.14 #1733

Merged
merged 1 commit into from Apr 14, 2022
Merged

Update git2 to 0.14 #1733

merged 1 commit into from Apr 14, 2022

Conversation

joshtriplett
Copy link
Contributor

git2-rs recently updated major versions due to libgit2 doing the same.
Bump the version used in sqlx accordingly, to allow users of the new
git2 to use git2::Oid with sqlx.

git2-rs recently updated major versions due to libgit2 doing the same.
Bump the version used in sqlx accordingly, to allow users of the new
git2 to use git2::Oid with sqlx.
@abonander
Copy link
Collaborator

This is a breaking change since it's a public dependency and so will have to be part of 0.6.0

@abonander abonander added this to the 0.6.0 milestone Mar 3, 2022
@joshtriplett
Copy link
Contributor Author

@abonander Ouch. Would you consider a git2-0-14 feature flag or similar (and then you could drop git2 in 0.6.0)?

@abonander
Copy link
Collaborator

We tried that with time and it got messy. Also, wouldn't there be collisions in linker symbols from two different versions of libgit2 being linked in if both features are enabled at the same time?

@abonander
Copy link
Collaborator

And now that I think about it more, this is kind of a weirdly arbitrary thing to integrate directly into SQLx. I think I'd rather work on a way to make it easier to create newtype wrappers to shuttle random types like git2::Oid in and out of SQL.

@joshtriplett
Copy link
Contributor Author

joshtriplett commented Mar 4, 2022

@abonander wrote:

We tried that with time and it got messy. Also, wouldn't there be collisions in linker symbols from two different versions of libgit2 being linked in if both features are enabled at the same time?

There would, but I'd be happy to ensure that such use cases get a clear compile-time error (e.g. "you can't enable both the git2 and git2-0-14 features"). The point of this is to migrate from one to the other, not to support using both simultaneously.

And now that I think about it more, this is kind of a weirdly arbitrary thing to integrate directly into SQLx.

I agree entirely. I'd love to figure out an appropriate language feature that would make it possible for such integration to occur in a separate sqlx-git2 crate rather than requiring it to be integrated into sqlx for trait-coherence reasons.

However, in the interim, I currently have code that's using git2 and sqlx, and I'd really like to upgrade to git2 0.14, but I can't currently do so because of this issue.

@joshtriplett
Copy link
Contributor Author

Nevermind, it seems that that isn't possible for things that link to a native library, even if they're controlled by features. :(

error: failed to select a version for `libgit2-sys`.
    ... required by package `git2 v0.14.0`
    ... which satisfies dependency `git2-0-14 = "^0.14"` of package `sqlx-core v0.5.11 (/home/josh/src/sqlx/sqlx-core)`
    ... which satisfies path dependency `sqlx-core` (locked to 0.5.11) of package `sqlx v0.5.11 (/home/josh/src/sqlx)`
    ... which satisfies path dependency `sqlx` (locked to 0.5.11) of package `json v0.1.0 (/home/josh/src/sqlx/examples/postgres/json)`
versions that meet the requirements `^0.13.0` are: 0.13.1+1.4.2, 0.13.0+1.4.1

the package `libgit2-sys` links to the native library `git2`, but it conflicts with a previous package which links to `git2` as well:
package `libgit2-sys v0.12.26+1.3.0`
    ... which satisfies dependency `libgit2-sys = "^0.12.26"` of package `git2 v0.13.25`
    ... which satisfies dependency `git2 = "^0.13.25"` of package `sqlx-core v0.5.11 (/home/josh/src/sqlx/sqlx-core)`
    ... which satisfies path dependency `sqlx-core` (locked to 0.5.11) of package `sqlx v0.5.11 (/home/josh/src/sqlx)`
    ... which satisfies path dependency `sqlx` (locked to 0.5.11) of package `json v0.1.0 (/home/josh/src/sqlx/examples/postgres/json)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='libgit2-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

failed to select a version for `libgit2-sys` which could resolve this conflict

@abonander
Copy link
Collaborator

So I'm thinking of something like:

#[derive(sqlx::Type)]
pub struct Git2Oid(#[sqlx(try_from = "Vec<u8>")] pub git2::Oid);

I'd really like to upgrade to git2 0.14, but I can't currently do so because of this issue.

Even more reason to move it out of SQLx, so you don't have to wait for us to upgrade.

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.

None yet

2 participants