Skip to content

Commit

Permalink
Add a binding for tag_annotation_create() (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
adaszko authored May 31, 2022
1 parent 8c8138c commit fe71885
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,38 @@ impl Repository {
}
}

/// Create a new tag in the repository from an object without creating a reference.
///
/// The message will not be cleaned up.
///
/// The tag name will be checked for validity. You must avoid the characters
/// '~', '^', ':', ' \ ', '?', '[', and '*', and the sequences ".." and " @
/// {" which have special meaning to revparse.
pub fn tag_annotation_create(
&self,
name: &str,
target: &Object<'_>,
tagger: &Signature<'_>,
message: &str,
) -> Result<Oid, Error> {
let name = CString::new(name)?;
let message = CString::new(message)?;
let mut raw_oid = raw::git_oid {
id: [0; raw::GIT_OID_RAWSZ],
};
unsafe {
try_call!(raw::git_tag_annotation_create(
&mut raw_oid,
self.raw,
name,
target.raw(),
tagger.raw(),
message
));
Ok(Binding::from_raw(&raw_oid as *const _))
}
}

/// Create a new lightweight tag pointing at a target object
///
/// A new direct reference will be created pointing to this target object.
Expand Down

0 comments on commit fe71885

Please sign in to comment.