Skip to content

Commit fe71885

Browse files
authored
Add a binding for tag_annotation_create() (#845)
1 parent 8c8138c commit fe71885

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/repo.rs

+32
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,38 @@ impl Repository {
18181818
}
18191819
}
18201820

1821+
/// Create a new tag in the repository from an object without creating a reference.
1822+
///
1823+
/// The message will not be cleaned up.
1824+
///
1825+
/// The tag name will be checked for validity. You must avoid the characters
1826+
/// '~', '^', ':', ' \ ', '?', '[', and '*', and the sequences ".." and " @
1827+
/// {" which have special meaning to revparse.
1828+
pub fn tag_annotation_create(
1829+
&self,
1830+
name: &str,
1831+
target: &Object<'_>,
1832+
tagger: &Signature<'_>,
1833+
message: &str,
1834+
) -> Result<Oid, Error> {
1835+
let name = CString::new(name)?;
1836+
let message = CString::new(message)?;
1837+
let mut raw_oid = raw::git_oid {
1838+
id: [0; raw::GIT_OID_RAWSZ],
1839+
};
1840+
unsafe {
1841+
try_call!(raw::git_tag_annotation_create(
1842+
&mut raw_oid,
1843+
self.raw,
1844+
name,
1845+
target.raw(),
1846+
tagger.raw(),
1847+
message
1848+
));
1849+
Ok(Binding::from_raw(&raw_oid as *const _))
1850+
}
1851+
}
1852+
18211853
/// Create a new lightweight tag pointing at a target object
18221854
///
18231855
/// A new direct reference will be created pointing to this target object.

0 commit comments

Comments
 (0)