From 1d41bf0447aabdfd2c10662fb31a59596faaebcd Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 14 Oct 2022 10:43:33 +0100 Subject: [PATCH 1/2] radicle-git-ext: remove link-git dependency link-git is still at an early stage and it's not certain what we will want to keep out of it, thus publishing it should be avoided. Remove `link-git` from `radicle-git-ext` for the time being. Signed-off-by: Fintan Halpenny --- radicle-git-ext/Cargo.toml | 4 ---- radicle-git-ext/src/oid.rs | 33 --------------------------------- 2 files changed, 37 deletions(-) diff --git a/radicle-git-ext/Cargo.toml b/radicle-git-ext/Cargo.toml index d0ffdc3..b668737 100644 --- a/radicle-git-ext/Cargo.toml +++ b/radicle-git-ext/Cargo.toml @@ -23,10 +23,6 @@ features = ["vendored-libgit2"] [dependencies.git-ref-format] path = "../git-ref-format" -[dependencies.link-git] -path = "../link-git" -optional = true - [dependencies.minicbor] version = "0.13" features = ["std"] diff --git a/radicle-git-ext/src/oid.rs b/radicle-git-ext/src/oid.rs index 907af14..c7ef1ed 100644 --- a/radicle-git-ext/src/oid.rs +++ b/radicle-git-ext/src/oid.rs @@ -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 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 for Oid { fn from(oid: git2::Oid) -> Self { Self(oid) @@ -136,28 +125,6 @@ impl From for git2::Oid { } } -#[cfg(feature = "link-git")] -impl From 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 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) From 5eccc79cd88c780af1c43fd3066077fa2ca6c027 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 14 Oct 2022 10:38:20 +0100 Subject: [PATCH 2/2] radicle-git-ext: prepare radicle-git-ext for publishing It is necessary to specify the version for `radicle-std-ext` in the `radicle-git-ext` Cargo.toml to publish it to crates.io. Signed-off-by: Fintan Halpenny --- radicle-git-ext/Cargo.toml | 3 +++ radicle-std-ext/Cargo.toml | 1 + 2 files changed, 4 insertions(+) diff --git a/radicle-git-ext/Cargo.toml b/radicle-git-ext/Cargo.toml index b668737..e5aa616 100644 --- a/radicle-git-ext/Cargo.toml +++ b/radicle-git-ext/Cargo.toml @@ -5,6 +5,7 @@ authors = ["The Radicle Team "] edition = "2018" license = "GPL-3.0-or-later" description = "Utilities and extensions to the git2 crate" +keywords = ["git", "radicle"] [lib] doctest = false @@ -21,6 +22,7 @@ default-features = false features = ["vendored-libgit2"] [dependencies.git-ref-format] +version = "0.1.0" path = "../git-ref-format" [dependencies.minicbor] @@ -34,4 +36,5 @@ features = ["derive"] optional = true [dependencies.radicle-std-ext] +version = "0.1.0" path = "../radicle-std-ext" diff --git a/radicle-std-ext/Cargo.toml b/radicle-std-ext/Cargo.toml index 139840f..60009c6 100644 --- a/radicle-std-ext/Cargo.toml +++ b/radicle-std-ext/Cargo.toml @@ -5,6 +5,7 @@ authors = ["The Radicle Team "] edition = "2018" license = "GPL-3.0-or-later" description = "Monkey patches of std types" +keywords = ["std", "radicle"] [lib] doctest = false