diff --git a/radicle-surf/src/lib.rs b/radicle-surf/src/lib.rs index 815fd75..3113878 100644 --- a/radicle-surf/src/lib.rs +++ b/radicle-surf/src/lib.rs @@ -82,18 +82,7 @@ extern crate radicle_git_ext as git_ext; pub mod diff; pub mod file_system; pub mod git; - -pub mod commit; -pub use commit::{commit, commits, Commit}; - -pub mod object; -pub use object::{blob, tree as objectTree, Blob, BlobContent, Info, ObjectType, Tree}; - -pub mod person; -pub use person::Person; - -pub mod revision; -pub use revision::Revision; +pub mod source; #[cfg(feature = "syntax")] pub mod syntax; diff --git a/radicle-surf/src/source.rs b/radicle-surf/src/source.rs new file mode 100644 index 0000000..457c9cb --- /dev/null +++ b/radicle-surf/src/source.rs @@ -0,0 +1,23 @@ +//! The `source` module provides a layer on top of the [`crate::git`] +//! functionality. +//! +//! It provides data types of [`Blob`]s, [`Tree`]s, and [`Commit`]s +//! (see [git objects][git-objects]). These types are analgous to +//! [`crate::file_system::File`], [`crate::file_system::Directory`], and +//! [`crate::git::Commit`]. However, they provide extra metadata and +//! can be serialized to serve to other applications. For example, +//! they could be used in an HTTP server for viewing a Git repository. +//! +//! [git-objects]: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects + +pub mod object; +pub use object::{blob, tree, Blob, BlobContent, Info, ObjectType, Tree}; + +pub mod commit; +pub use commit::{commit, commits, Commit}; + +pub mod person; +pub use person::Person; + +pub mod revision; +pub use revision::Revision; diff --git a/radicle-surf/src/commit.rs b/radicle-surf/src/source/commit.rs similarity index 99% rename from radicle-surf/src/commit.rs rename to radicle-surf/src/source/commit.rs index d2b77cf..2b1483f 100644 --- a/radicle-surf/src/commit.rs +++ b/radicle-surf/src/source/commit.rs @@ -29,8 +29,7 @@ use serde::{ use crate::{ diff, git::{self, glob, Glob, Repository}, - person::Person, - revision::Revision, + source::{person::Person, revision::Revision}, }; use radicle_git_ext::Oid; diff --git a/radicle-surf/src/object.rs b/radicle-surf/src/source/object.rs similarity index 98% rename from radicle-surf/src/object.rs rename to radicle-surf/src/source/object.rs index 4ef08b3..39105ab 100644 --- a/radicle-surf/src/object.rs +++ b/radicle-surf/src/source/object.rs @@ -32,7 +32,7 @@ pub use blob::{Blob, BlobContent}; pub mod tree; pub use tree::{tree, Tree, TreeEntry}; -use crate::{commit, file_system::directory, git}; +use crate::{file_system::directory, git, source::commit}; /// Git object types. /// diff --git a/radicle-surf/src/object/blob.rs b/radicle-surf/src/source/object/blob.rs similarity index 98% rename from radicle-surf/src/object/blob.rs rename to radicle-surf/src/source/object/blob.rs index b8bef4d..65d8161 100644 --- a/radicle-surf/src/object/blob.rs +++ b/radicle-surf/src/source/object/blob.rs @@ -30,10 +30,12 @@ use serde::{ }; use crate::{ - commit, git::Repository, - object::{Error, Info, ObjectType}, - revision::Revision, + source::{ + commit, + object::{Error, Info, ObjectType}, + revision::Revision, + }, }; #[cfg(feature = "syntax")] diff --git a/radicle-surf/src/object/tree.rs b/radicle-surf/src/source/object/tree.rs similarity index 97% rename from radicle-surf/src/object/tree.rs rename to radicle-surf/src/source/object/tree.rs index e60c26c..03b8e0f 100644 --- a/radicle-surf/src/object/tree.rs +++ b/radicle-surf/src/source/object/tree.rs @@ -28,11 +28,13 @@ use serde::{ }; use crate::{ - commit, file_system::directory, git::Repository, - object::{Error, Info, ObjectType}, - revision::Revision, + source::{ + commit, + object::{Error, Info, ObjectType}, + revision::Revision, + }, }; /// Result of a directory listing, carries other trees and blobs. diff --git a/radicle-surf/src/person.rs b/radicle-surf/src/source/person.rs similarity index 100% rename from radicle-surf/src/person.rs rename to radicle-surf/src/source/person.rs diff --git a/radicle-surf/src/revision.rs b/radicle-surf/src/source/revision.rs similarity index 100% rename from radicle-surf/src/revision.rs rename to radicle-surf/src/source/revision.rs