Sebastian Thielj fmtc3c65041 year agoHistory
29 lines · 798 B · Rust
RawDownload
use anyhow::bail; use crate::OutputFormat; pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write, format: OutputFormat) -> anyhow::Result<()> {    if format != OutputFormat::Human {        bail!("JSON output isn't implemented yet");    }     if let Some(worktree) = repo.worktree() {        writeln!(            out,            "{base} [{branch}]",            base = gix::path::realpath(worktree.base())?.display(),            branch = repo                .head_name()?                .map_or("<detached>".into(), |name| name.shorten().to_owned()),        )?;    }    for proxy in repo.worktrees()? {        writeln!(            out,            "{base} [{name}]",            base = proxy.base()?.display(),            name = proxy.id()        )?;    }    Ok(())}