Skip to content

Commit

Permalink
feat(changelog): populate template with tag oid
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Nov 30, 2021
1 parent 0618192 commit 679928f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/conventional/changelog/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ impl Serialize for OidOf {
match self {
OidOf::Tag(tag) => {
oidof.serialize_field("tag", &tag.to_string_with_prefix())?;
if let Some(oid) = tag.oid() {
oidof.serialize_field("id", &oid.to_string())?;
}
}
OidOf::Head(oid) | OidOf::Other(oid) => {
oidof.serialize_field("id", &oid.to_string())?
Expand Down
4 changes: 4 additions & 0 deletions src/git/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ impl Tag {
self.oid.as_ref().unwrap()
}

pub(crate) fn oid(&self) -> Option<&Oid> {
self.oid.as_ref()
}

pub(crate) fn new(name: &str, oid: Option<Oid>) -> Result<Tag> {
let tag = match SETTINGS.tag_prefix.as_ref() {
None => Ok(name),
Expand Down

0 comments on commit 679928f

Please sign in to comment.