rsmultigit 0.1.15

Manage multiple git repositories at once
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::path::Path;

use anyhow::Result;

use crate::subprocess_utils::capture_output_allow_failure;

/// Show the most recent tag. Returns None if no tags exist.
pub fn do_last_tag(project: &Path) -> Result<Option<String>> {
    let (code, stdout, _stderr) =
        capture_output_allow_failure(project, "git", &["describe", "--tags", "--abbrev=0"])?;
    let trimmed = stdout.trim().to_string();
    if code == 0 && !trimmed.is_empty() {
        Ok(Some(trimmed))
    } else {
        Ok(None)
    }
}