radicle-surf: source module

This is a straightforward move of all the code source browsing modules
into a module called `source`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-11-30 13:22:43 +00:00
parent 5b6b447a96
commit 02321aba7c
8 changed files with 36 additions and 21 deletions
+1 -12
View File
@@ -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;
+23
View File
@@ -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;
@@ -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;
@@ -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.
///
@@ -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")]
@@ -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.