rsmultigit 0.1.8

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

use anyhow::Result;

use crate::commands::count::has_changes;
use crate::subprocess_utils::check_call;

/// Commit all staged and unstaged changes with a message.
/// Skips repos that have no changes.
pub fn do_commit(project: &Path, message: &str) -> Result<bool> {
    let (dirty, untracked) = has_changes(project)?;
    if !dirty && !untracked {
        return Ok(false);
    }
    check_call(project, "git", &["add", "-A"])?;
    check_call(project, "git", &["commit", "-m", message])?;
    Ok(true)
}