Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a binding for tag_annotation_create() #845

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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