From c857b9b6a113bd60fa3c9aeaf3edb81164ae772a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 19 Sep 2022 17:56:58 +0800 Subject: [PATCH] diff platform for basic diff configuration (#470) --- git-repository/src/object/tree/mod.rs | 25 +++++++++++++++++++++- git-repository/src/object/tree/traverse.rs | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/git-repository/src/object/tree/mod.rs b/git-repository/src/object/tree/mod.rs index dac6147a891..997d5d5ee53 100644 --- a/git-repository/src/object/tree/mod.rs +++ b/git-repository/src/object/tree/mod.rs @@ -22,7 +22,7 @@ impl<'repo> Tree<'repo> { Id::from_id(self.id, self.repo) } - // TODO: move implementation to git-object, tests. + // TODO: tests. /// Follow a sequence of `path` components starting from this instance, and look them up one by one until the last component /// is looked up and its tree entry is returned. /// @@ -62,6 +62,29 @@ impl<'repo> Tree<'repo> { } } +#[allow(missing_docs)] +/// +pub mod diff { + use crate::Tree; + + impl<'repo> Tree<'repo> { + pub fn changes<'other_repo, 'a>(&'a self) -> Platform<'a, 'repo> { + Platform { lhs: self } + } + } + + #[allow(dead_code)] + pub struct Platform<'a, 'repo> { + lhs: &'a Tree<'repo>, + } + + impl<'a, 'repo> Platform<'a, 'repo> { + pub fn to_obtain_tree(&self, _other: &Tree<'_>) { + todo!() + } + } +} + /// pub mod traverse; diff --git a/git-repository/src/object/tree/traverse.rs b/git-repository/src/object/tree/traverse.rs index 7ae51d53ea1..b95d4d46da8 100644 --- a/git-repository/src/object/tree/traverse.rs +++ b/git-repository/src/object/tree/traverse.rs @@ -15,11 +15,11 @@ impl<'repo> Tree<'repo> { /// An intermediate object to start traversing the parent tree from. pub struct Platform<'a, 'repo> { root: &'a Tree<'repo>, - /// TODO: EXPLAIN + #[allow(missing_docs)] // TODO pub breadthfirst: BreadthFirstPresets<'a, 'repo>, } -/// TODO: explain THIS! +#[allow(missing_docs)] // TODO #[derive(Copy, Clone)] pub struct BreadthFirstPresets<'a, 'repo> { root: &'a Tree<'repo>,