summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/id.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix/src/id.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/id.rs')
-rw-r--r--vendor/gix/src/id.rs23
1 files changed, 18 insertions, 5 deletions
diff --git a/vendor/gix/src/id.rs b/vendor/gix/src/id.rs
index 0d5c86752..7214ec320 100644
--- a/vendor/gix/src/id.rs
+++ b/vendor/gix/src/id.rs
@@ -3,9 +3,9 @@ use std::ops::Deref;
use gix_hash::{oid, ObjectId};
-use crate::{object::find, revision, Id, Object};
+use crate::{object::find, Id, Object};
-/// An [object id][ObjectId] infused with `Easy`.
+/// An [object id][ObjectId] infused with a [`Repository`][crate::Repository].
impl<'repo> Id<'repo> {
/// Find the [`Object`] associated with this object id, and consider it an error if it doesn't exist.
///
@@ -16,6 +16,13 @@ impl<'repo> Id<'repo> {
self.repo.find_object(self.inner)
}
+ /// Find the [`header`][gix_odb::find::Header] associated with this object id, or an error if it doesn't exist.
+ ///
+ /// Use this method if there is no interest in the contents of the object, which generally is much faster to obtain.
+ pub fn header(&self) -> Result<gix_odb::find::Header, find::existing::Error> {
+ self.repo.find_header(self.inner)
+ }
+
/// Try to find the [`Object`] associated with this object id, and return `None` if it's not available locally.
///
/// # Note
@@ -25,6 +32,13 @@ impl<'repo> Id<'repo> {
self.repo.try_find_object(self.inner)
}
+ /// Find the [`header`][gix_odb::find::Header] associated with this object id, or return `None` if it doesn't exist.
+ ///
+ /// Use this method if there is no interest in the contents of the object, which generally is much faster to obtain.
+ pub fn try_header(&self) -> Result<Option<gix_odb::find::Header>, find::Error> {
+ self.repo.try_find_header(self.inner)
+ }
+
/// Turn this object id into a shortened id with a length in hex as configured by `core.abbrev`.
pub fn shorten(&self) -> Result<gix_hash::Prefix, shorten::Error> {
let hex_len = self.repo.config.hex_len.map_or_else(
@@ -89,9 +103,8 @@ impl<'repo> Id<'repo> {
impl<'repo> Id<'repo> {
/// Obtain a platform for traversing ancestors of this commit.
- ///
- pub fn ancestors(&self) -> revision::walk::Platform<'repo> {
- revision::walk::Platform::new(Some(self.inner), self.repo)
+ pub fn ancestors(&self) -> crate::revision::walk::Platform<'repo> {
+ crate::revision::walk::Platform::new(Some(self.inner), self.repo)
}
}