diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix/src/object/mod.rs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/object/mod.rs')
-rw-r--r-- | vendor/gix/src/object/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vendor/gix/src/object/mod.rs b/vendor/gix/src/object/mod.rs index 75d77d138..d0a37db6c 100644 --- a/vendor/gix/src/object/mod.rs +++ b/vendor/gix/src/object/mod.rs @@ -90,6 +90,14 @@ impl<'repo> Object<'repo> { } } + /// Transform this object into a tag, or panic if it is none. + pub fn into_tag(self) -> Tag<'repo> { + match self.try_into() { + Ok(tag) => tag, + Err(this) => panic!("Tried to use {} as commit, but was {}", this.id, this.kind), + } + } + /// Transform this object into a commit, or return it as part of the `Err` if it is no commit. pub fn try_into_commit(self) -> Result<Commit<'repo>, try_into::Error> { self.try_into().map_err(|this: Self| try_into::Error { @@ -157,7 +165,7 @@ impl<'repo> Object<'repo> { }) } - /// Obtain a an iterator over commit tokens like in [`to_commit_iter()`][Object::try_to_commit_ref_iter()]. + /// Obtain an iterator over commit tokens like in [`to_commit_iter()`][Object::try_to_commit_ref_iter()]. /// /// # Panic /// |