summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/repository/reference.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/gix/src/repository/reference.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/repository/reference.rs')
-rw-r--r--vendor/gix/src/repository/reference.rs9
1 files changed, 9 insertions, 0 deletions
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<crate::Id<'_>, 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.
///