From 350c70bf1569815534d028eafa810b34d04f1f3d Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 22 Feb 2024 14:56:13 +0000 Subject: fix(pull): local rebase detected as ammendments also updated copy and code comments --- src/git.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/git.rs') diff --git a/src/git.rs b/src/git.rs index 6edca0f..41d68c7 100644 --- a/src/git.rs +++ b/src/git.rs @@ -68,6 +68,7 @@ pub trait RepoActions { patch_and_ancestors: Vec, ) -> Result>; fn parse_starting_commits(&self, starting_commits: &str) -> Result>; + fn ancestor_of(&self, decendant: &Sha1Hash, ancestor: &Sha1Hash) -> Result; } impl RepoActions for Repo { @@ -461,6 +462,18 @@ impl RepoActions for Repo { bail!("specified value not in a supported format") } } + + fn ancestor_of(&self, decendant: &Sha1Hash, ancestor: &Sha1Hash) -> Result { + if let Ok(res) = self + .git_repo + .graph_descendant_of(sha1_to_oid(decendant)?, sha1_to_oid(ancestor)?) + .context("could not run graph_descendant_of in gitlib2") + { + Ok(res) + } else { + Ok(false) + } + } } fn oid_to_u8_20_bytes(oid: &Oid) -> [u8; 20] { -- cgit v1.2.3