mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-15 16:00:35 +08:00
Merge remote-tracking branch 'origin/publish/git-ext'
* origin/publish/git-ext: radicle-git-ext: prepare radicle-git-ext for publishing radicle-git-ext: remove link-git dependency
This commit is contained in:
@@ -5,6 +5,7 @@ authors = ["The Radicle Team <dev@radicle.xyz>"]
|
||||
edition = "2018"
|
||||
license = "GPL-3.0-or-later"
|
||||
description = "Utilities and extensions to the git2 crate"
|
||||
keywords = ["git", "radicle"]
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
@@ -21,12 +22,9 @@ default-features = false
|
||||
features = ["vendored-libgit2"]
|
||||
|
||||
[dependencies.git-ref-format]
|
||||
version = "0.1.0"
|
||||
path = "../git-ref-format"
|
||||
|
||||
[dependencies.link-git]
|
||||
path = "../link-git"
|
||||
optional = true
|
||||
|
||||
[dependencies.minicbor]
|
||||
version = "0.13"
|
||||
features = ["std"]
|
||||
@@ -38,4 +36,5 @@ features = ["derive"]
|
||||
optional = true
|
||||
|
||||
[dependencies.radicle-std-ext]
|
||||
version = "0.1.0"
|
||||
path = "../radicle-std-ext"
|
||||
|
||||
@@ -13,9 +13,6 @@ use std::{
|
||||
use multihash::{Multihash, MultihashRef};
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(feature = "link-git")]
|
||||
use link_git::hash as git_hash;
|
||||
|
||||
/// Serializable [`git2::Oid`]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct Oid(git2::Oid);
|
||||
@@ -116,14 +113,6 @@ impl AsRef<[u8]> for Oid {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "link-git")]
|
||||
impl AsRef<git_hash::oid> for Oid {
|
||||
fn as_ref(&self) -> &git_hash::oid {
|
||||
// SAFETY: checks the length of the slice, which we know is correct
|
||||
git_hash::oid::try_from(self.as_bytes()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<git2::Oid> for Oid {
|
||||
fn from(oid: git2::Oid) -> Self {
|
||||
Self(oid)
|
||||
@@ -136,28 +125,6 @@ impl From<Oid> for git2::Oid {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "link-git")]
|
||||
impl From<git_hash::ObjectId> for Oid {
|
||||
fn from(git_hash::ObjectId::Sha1(bs): git_hash::ObjectId) -> Self {
|
||||
// SAFETY: checks the length of the slice, which we statically know
|
||||
Self(git2::Oid::from_bytes(&bs).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "link-git")]
|
||||
impl From<Oid> for git_hash::ObjectId {
|
||||
fn from(oid: Oid) -> Self {
|
||||
Self::from_20_bytes(oid.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "link-git")]
|
||||
impl<'a> From<&'a Oid> for &'a git_hash::oid {
|
||||
fn from(oid: &'a Oid) -> Self {
|
||||
oid.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Oid {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
self.0.fmt(f)
|
||||
|
||||
@@ -5,6 +5,7 @@ authors = ["The Radicle Team <dev@radicle.xyz>"]
|
||||
edition = "2018"
|
||||
license = "GPL-3.0-or-later"
|
||||
description = "Monkey patches of std types"
|
||||
keywords = ["std", "radicle"]
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
Reference in New Issue
Block a user