Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
bin: Add more commits to test repo fixtures
Erik Kundt committed 1 year ago
commit 681d95b392ad16772a9075c640a5e37c250ddf1e
parent 9743396
3 files changed +47 -2
modified Cargo.lock
@@ -1873,6 +1873,7 @@ dependencies = [
 "ansi-to-tui",
 "anyhow",
 "fuzzy-matcher",
+
 "git2",
 "homedir",
 "inquire",
 "lazy_static",
@@ -1883,6 +1884,7 @@ dependencies = [
 "pretty_assertions",
 "radicle",
 "radicle-cli",
+
 "radicle-git-ext",
 "radicle-signals",
 "radicle-surf",
 "radicle-term",
modified Cargo.toml
@@ -54,4 +54,11 @@ tui-tree-widget = { version = "0.21.0" }

[dev-dependencies]
pretty_assertions = "^1.4.1"
-
radicle = { version = "0.14.0", features = ["test"]}

\ No newline at end of file
+
radicle = { version = "0.14.0", features = ["test"]}
+
radicle-git-ext = { version = "0.8.0", features = ["serde"] }
+

+

+
[dev-dependencies.git2]
+
version = "0.19.0"
+
default-features = false
+
features = ["vendored-libgit2"]

\ No newline at end of file
modified bin/test.rs
@@ -1,13 +1,49 @@
pub mod fixtures {
+
    use std::path::Path;
+

    use anyhow::Result;

    use radicle::cob::cache::NoCache;
+
    use radicle::git;
    use radicle::patch::{Cache, MergeTarget, PatchMut, Patches};
    use radicle::storage::git::Repository;
+
    use radicle::storage::WriteRepository;
    use radicle::test::setup::{BranchWith, NodeWithRepo};

+
    /// The birth of the radicle project, January 1st, 2018.
+
    pub const RADICLE_EPOCH: i64 = 1514817556;
+

    pub fn node_with_repo() -> NodeWithRepo {
-
        NodeWithRepo::default()
+
        let node = NodeWithRepo::default();
+
        let repo = node.repo.repo.raw();
+

+
        let sig = git2::Signature::new(
+
            "anonymous",
+
            "anonymous@radicle.xyz",
+
            &git2::Time::new(RADICLE_EPOCH, 0),
+
        )
+
        .unwrap();
+

+
        let head = repo
+
            .find_commit(repo.head().unwrap().target().unwrap())
+
            .unwrap();
+
        let tree =
+
            git::write_tree(Path::new("main.rs"), "pub fn main() {}\n".as_bytes(), &repo).unwrap();
+

+
        git::commit(
+
            &repo,
+
            &head,
+
            git::refname!("refs/heads/master").as_refstr(),
+
            "Another commit",
+
            &sig,
+
            &tree,
+
        )
+
        .unwrap();
+

+
        drop(tree);
+
        drop(head);
+

+
        node
    }

    pub fn branch_with_eof_removed(node: &NodeWithRepo) -> BranchWith {