Skip to content

Commit fec6db8

Browse files
committed
nicer printing of fixes (#450)
1 parent 91d1a3a commit fec6db8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

gitoxide-core/src/repository/remote.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mod refs_impl {
33
use anyhow::bail;
44
use git_repository as git;
55
use git_repository::protocol::fetch;
6+
use git_repository::refspec::match_group::validate::Fix;
67
use git_repository::refspec::RefSpec;
78

89
use crate::OutputFormat;
@@ -128,9 +129,25 @@ mod refs_impl {
128129
}?;
129130
}
130131
if !map.fixes.is_empty() {
131-
writeln!(err, "Fixes and sanitizations")?;
132+
writeln!(
133+
err,
134+
"The following destination refs were removed as they didn't start with 'ref/'"
135+
)?;
136+
map.fixes.sort_by_key(|f| match f {
137+
Fix::MappingWithPartialDestinationRemoved { spec, .. } => *spec,
138+
});
139+
let mut prev_spec = None;
132140
for fix in &map.fixes {
133-
writeln!(err, "\t{fix:?}")?;
141+
match fix {
142+
Fix::MappingWithPartialDestinationRemoved { name, spec } => {
143+
if prev_spec.map_or(true, |prev_spec| prev_spec != spec) {
144+
prev_spec = spec.into();
145+
spec.write_to(&mut err)?;
146+
writeln!(err)?;
147+
}
148+
writeln!(err, "\t{name}")?;
149+
}
150+
}
134151
}
135152
}
136153
Ok(())

0 commit comments

Comments
 (0)