Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
  • Loading branch information
MeitarR and orhun committed Jun 21, 2024
1 parent bd79b22 commit 1f41a6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
21 changes: 10 additions & 11 deletions git-cliff-core/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,17 @@ impl Repository {
}

/// Returns the tag object of the given name.
/// if given name don't exists, still returns Tag object with the given name
///
/// If given name doesn't exist, it still returns `Tag` with the given name.
pub fn resolve_tag(&self, name: &str) -> Tag {
match self.inner.resolve_reference_from_short_name(name) {
Ok(reference) => match reference.peel_to_tag() {
Ok(tag) => Tag {
name: tag.name().unwrap_or_default().to_owned(),
message: tag.message().map(Self::cleanup_message),
},
_ => Tag {
name: name.to_owned(),
message: None,
},
match self
.inner
.resolve_reference_from_short_name(name)
.and_then(|r| r.peel_to_tag())
{
Ok(tag) => Tag {
name: tag.name().unwrap_or_default().to_owned(),
message: tag.message().map(Self::cleanup_message),
},
_ => Tag {
name: name.to_owned(),
Expand Down
3 changes: 2 additions & 1 deletion git-cliff-core/src/tag.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// Common tag object that is parsed from a repository.
/// lightweight tag will have None at message.
///
/// Lightweight tags will have `None` as message.
#[derive(Debug)]
pub struct Tag {
/// The name of the tag
Expand Down

0 comments on commit 1f41a6d

Please sign in to comment.