1use anyhow::{Context, Result};
2use gn_core::Namespace;
3use std::path::Path;
4use std::process::Command;
5
6pub fn push_notes(repo_path: &Path, remote: &str, namespaces: &[Namespace]) -> Result<()> {
7 for ns in namespaces {
8 let ref_path = ns.ref_path();
9 let refspec = format!("{}:{}", ref_path, ref_path);
10
11 let status = Command::new("git")
12 .current_dir(repo_path)
13 .args(["push", remote, &refspec])
14 .status()
15 .with_context(|| format!("Failed to push namespace {}", ns))?;
16
17 if !status.success() {
18 tracing::warn!("Push failed for namespace {}", ns);
21 }
22 }
23
24 Ok(())
25}