Skip to content

Commit d42c274

Browse files
committed
Allow find tag by prefix hash
1 parent 0731960 commit d42c274

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/repo.rs

+14
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,20 @@ impl Repository {
19631963
}
19641964
}
19651965

1966+
/// Lookup a tag object by prefix hash from the repository.
1967+
pub fn find_tag_by_prefix(&self, prefix_hash: &str) -> Result<Tag<'_>, Error> {
1968+
let mut raw = ptr::null_mut();
1969+
unsafe {
1970+
try_call!(raw::git_tag_lookup_prefix(
1971+
&mut raw,
1972+
self.raw,
1973+
Oid::from_str(prefix_hash)?.raw(),
1974+
prefix_hash.len()
1975+
));
1976+
Ok(Binding::from_raw(raw))
1977+
}
1978+
}
1979+
19661980
/// Delete an existing tag reference.
19671981
///
19681982
/// The tag name will be checked for validity, see `tag` for some rules

0 commit comments

Comments
 (0)