From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/gix/src/repository/reference.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vendor/gix/src/repository/reference.rs') diff --git a/vendor/gix/src/repository/reference.rs b/vendor/gix/src/repository/reference.rs index 5a14c60b5..e57ca63c0 100644 --- a/vendor/gix/src/repository/reference.rs +++ b/vendor/gix/src/repository/reference.rs @@ -212,6 +212,15 @@ impl crate::Repository { Ok(self.head()?.peel_to_commit_in_place()?) } + /// Return the tree id the `HEAD` reference currently points to after peeling it fully. + /// + /// Note that this may fail for various reasons, most notably because the repository + /// is freshly initialized and doesn't have any commits yet. It could also fail if the + /// head does not point to a commit. + pub fn head_tree_id(&self) -> Result, reference::head_tree_id::Error> { + Ok(self.head()?.peel_to_commit_in_place()?.tree_id()?) + } + /// Find the reference with the given partial or full `name`, like `main`, `HEAD`, `heads/branch` or `origin/other`, /// or return an error if it wasn't found. /// -- cgit v1.2.3