diff options
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 /// |