Skip to content

Commit

Permalink
Allow find tag by prefix hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 2, 2024
1 parent 0731960 commit d42c274
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,20 @@ impl Repository {
}
}

/// Lookup a tag object by prefix hash from the repository.
pub fn find_tag_by_prefix(&self, prefix_hash: &str) -> Result<Tag<'_>, Error> {
let mut raw = ptr::null_mut();
unsafe {
try_call!(raw::git_tag_lookup_prefix(
&mut raw,
self.raw,
Oid::from_str(prefix_hash)?.raw(),
prefix_hash.len()
));
Ok(Binding::from_raw(raw))
}
}

/// Delete an existing tag reference.
///
/// The tag name will be checked for validity, see `tag` for some rules
Expand Down

0 comments on commit d42c274

Please sign in to comment.