diff --git a/Cargo.toml b/Cargo.toml index 0ca20c1..bf87dcd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,6 @@ members = [ "git-trailers", "link-git", "radicle-git-ext", - "radicle-git-types", - "radicle-macros", "radicle-std-ext", "radicle-surf", # TODO: port gitd-lib over diff --git a/git-storage/src/glob.rs b/git-storage/src/glob.rs index 8989417..b58fcc5 100644 --- a/git-storage/src/glob.rs +++ b/git-storage/src/glob.rs @@ -5,7 +5,6 @@ use std::path::Path; -use git_ext as ext; use git_ref_format::refspec::PatternString; pub trait Pattern { @@ -27,12 +26,6 @@ impl Pattern for globset::GlobSet { #[derive(Clone, Debug)] pub struct RefspecMatcher(globset::GlobMatcher); -impl From for RefspecMatcher { - fn from(pat: ext::RefspecPattern) -> Self { - Self(globset::Glob::new(pat.as_str()).unwrap().compile_matcher()) - } -} - impl From for RefspecMatcher { fn from(pat: PatternString) -> Self { Self(globset::Glob::new(pat.as_str()).unwrap().compile_matcher()) diff --git a/git-storage/t/Cargo.toml b/git-storage/t/Cargo.toml index 134b6c0..1ac59fb 100644 --- a/git-storage/t/Cargo.toml +++ b/git-storage/t/Cargo.toml @@ -35,7 +35,7 @@ path = "../../test/test-helpers" version = "1" features = ["v4"] -[dev-dependencies.git-ext-test] +[dev-dependencies.radicle-git-ext-test] path = "../../radicle-git-ext/t" features = ["test"] diff --git a/radicle-git-ext/src/author.rs b/radicle-git-ext/src/author.rs new file mode 100644 index 0000000..34a5d62 --- /dev/null +++ b/radicle-git-ext/src/author.rs @@ -0,0 +1,129 @@ +use std::{ + fmt, + num::ParseIntError, + str::{self, FromStr}, +}; + +use thiserror::Error; + +/// The data for indicating authorship of an action within a +/// [`crate::commit::Commit`]. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +pub struct Author { + /// Name corresponding to `user.name` in the git config. + /// + /// Note: this must not contain `<` or `>`. + pub name: String, + /// Email corresponding to `user.email` in the git config. + /// + /// Note: this must not contain `<` or `>`. + pub email: String, + /// The time of this author's action. + pub time: Time, +} + +/// The time of a [`Author`]'s action. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct Time { + seconds: i64, + offset: i32, +} + +impl Time { + pub fn new(seconds: i64, offset: i32) -> Self { + Self { seconds, offset } + } + + /// Return the time, in seconds, since the epoch. + pub fn seconds(&self) -> i64 { + self.seconds + } + + /// Return the timezone offset, in minutes. + pub fn offset(&self) -> i32 { + self.offset + } +} + +impl From