diff --git a/git-repository/src/remote/connection/ref_map.rs b/git-repository/src/remote/connection/ref_map.rs index e8b43e69bc0..4e982110ae2 100644 --- a/git-repository/src/remote/connection/ref_map.rs +++ b/git-repository/src/remote/connection/ref_map.rs @@ -3,7 +3,7 @@ use git_protocol::transport::client::Transport; use crate::remote::{connection::HandshakeWithRefs, fetch, Connection, Direction}; -/// The error returned by [`Connection::list_refs_to_map()`]. +/// The error returned by [`Connection::ref_map()`]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] pub enum Error { diff --git a/gitoxide-core/src/repository/remote.rs b/gitoxide-core/src/repository/remote.rs index 3af80f9c528..b4a08dcc0bf 100644 --- a/gitoxide-core/src/repository/remote.rs +++ b/gitoxide-core/src/repository/remote.rs @@ -32,6 +32,7 @@ mod refs_impl { kind: refs::Kind, mut progress: impl git::Progress, out: impl std::io::Write, + err: impl std::io::Write, refs::Context { format, name, url }: refs::Context, ) -> anyhow::Result<()> { use anyhow::Context; @@ -64,7 +65,7 @@ mod refs_impl { .await?; match kind { - refs::Kind::Tracking { .. } => print_refmap(&repo, remote, map, out), + refs::Kind::Tracking { .. } => print_refmap(&repo, remote, map, out, err), refs::Kind::Remote => { match format { OutputFormat::Human => drop(print(out, &map.remote_refs)), @@ -84,6 +85,7 @@ mod refs_impl { remote: git::Remote<'_>, mut map: git::remote::fetch::RefMap, mut out: impl std::io::Write, + mut err: impl std::io::Write, ) -> anyhow::Result<()> { let mut last_spec_index = usize::MAX; map.mappings.sort_by_key(|m| m.spec_index); @@ -105,7 +107,7 @@ mod refs_impl { }; match &mapping.local { Some(local) => { - write!(out, " -> {} ", local)?; + write!(out, " -> {local} ")?; match repo.try_find_reference(local)? { Some(tracking) => { let msg = match tracking.try_id() { @@ -122,6 +124,12 @@ mod refs_impl { None => writeln!(out, " (fetch only)"), }?; } + if !map.fixes.is_empty() { + writeln!(err, "Fixes and sanitizations")?; + for fix in &map.fixes { + writeln!(err, "\t{fix:?}")?; + } + } Ok(()) } diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index 304679fd302..4fef57ea873 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -137,12 +137,13 @@ pub fn main() -> Result<()> { progress, progress_keep_open, core::repository::remote::refs::PROGRESS_RANGE, - move |progress, out, _err| { + move |progress, out, err| { core::repository::remote::refs( repository(Mode::LenientWithGitInstallConfig)?, kind, progress, out, + err, core::repository::remote::refs::Context { name, url, format }, ) }, @@ -160,6 +161,7 @@ pub fn main() -> Result<()> { kind, progress, std::io::stdout(), + std::io::stderr(), core::repository::remote::refs::Context { name, url, format }, )) } diff --git a/src/plumbing/options.rs b/src/plumbing/options.rs index a7f3fd4bad9..27285959bfd 100644 --- a/src/plumbing/options.rs +++ b/src/plumbing/options.rs @@ -110,7 +110,6 @@ pub mod config { pub mod remote { use git_repository as git; - use git_repository::bstr::BString; #[derive(Debug, clap::Parser)] pub struct Platform { @@ -140,7 +139,7 @@ pub mod remote { RefMap { /// Override the built-in and configured ref-specs with one or more of the given ones. #[clap(parse(try_from_os_str = git::env::os_str_to_bstring))] - ref_spec: Vec, + ref_spec: Vec, }, } }