Skip to main content

Module tags

Module tags 

Source
Available on crate feature workflow only.
Expand description

Typed listing and bulk operations on tags.

Reached through Repository::tags, which returns a TagOps handle:

use git_spawn::Repository;
use git_spawn::tags::TagKind;

let repo = Repository::open("/path/to/repo")?;

for tag in repo.tags().list().await? {
    match tag.kind {
        TagKind::Annotated => println!("{} (annotated): {}",
            tag.name,
            tag.message.as_deref().unwrap_or("")),
        TagKind::Lightweight => println!("{} (lightweight) -> {}", tag.name, tag.target),
    }
}

repo.tags().create("v0.1.0", "HEAD").await?;
repo.tags().create_annotated("v0.2.0", "HEAD", "release 0.2.0").await?;

Like crate::branches, listing uses for-each-ref with a fixed NUL-delimited format string.

Structs§

Tag
One tag.
TagOps
Operations on tags, scoped to a Repository.
Tagger
Tagger identity attached to an annotated tag.

Enums§

TagKind
Lightweight vs. annotated tag.