mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 22:22:02 +02:00
21 lines
638 B
Rust
21 lines
638 B
Rust
use crate::binary::new_binary_command;
|
|
use crate::error::Error::GenericError;
|
|
use crate::error::Result;
|
|
use std::path::Path;
|
|
|
|
pub fn git_fetch_all(dir: &Path) -> Result<()> {
|
|
let out = new_binary_command(dir)?
|
|
.args(["fetch", "--all", "--prune", "--tags"])
|
|
.output()
|
|
.map_err(|e| GenericError(format!("failed to run git pull: {e}")))?;
|
|
let stdout = String::from_utf8_lossy(&out.stdout);
|
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
|
let combined = stdout + stderr;
|
|
|
|
if !out.status.success() {
|
|
return Err(GenericError(format!("Failed to fetch: {}", combined)));
|
|
}
|
|
|
|
Ok(())
|
|
}
|