use std::path::Path;
use crate::error::Result;
use crate::shell::exec;
pub fn pull_in_directory(path: &Path) -> Result<String> {
exec("git", &["pull"], Some(path))
}
pub fn is_already_up_to_date(output: &str) -> bool {
output.contains("Already up to date") || output.contains("Already up-to-date")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_already_up_to_date_true() {
assert!(is_already_up_to_date("Already up to date."));
assert!(is_already_up_to_date("Already up-to-date."));
}
#[test]
fn test_is_already_up_to_date_false() {
assert!(!is_already_up_to_date("Updating abc123..def456"));
assert!(!is_already_up_to_date("Fast-forward"));
}
}