mirror of
https://github.com/RGBCube/dix
synced 2025-07-27 19:57:44 +00:00
fix: don't write double newlines when package diff doesn't exist
This commit is contained in:
parent
553e594968
commit
d85e9ec3b0
2 changed files with 7 additions and 5 deletions
|
@ -47,7 +47,7 @@ pub fn write_diffln<'a>(
|
||||||
writer: &mut dyn fmt::Write,
|
writer: &mut dyn fmt::Write,
|
||||||
paths_old: impl Iterator<Item = &'a StorePath>,
|
paths_old: impl Iterator<Item = &'a StorePath>,
|
||||||
paths_new: impl Iterator<Item = &'a StorePath>,
|
paths_new: impl Iterator<Item = &'a StorePath>,
|
||||||
) -> fmt::Result {
|
) -> Result<usize, fmt::Error> {
|
||||||
let mut paths =
|
let mut paths =
|
||||||
FxHashMap::<&str, Diff<Vec<Option<&Version>>>>::with_hasher(FxBuildHasher);
|
FxHashMap::<&str, Diff<Vec<Option<&Version>>>>::with_hasher(FxBuildHasher);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ pub fn write_diffln<'a>(
|
||||||
|
|
||||||
let mut last_status = None::<DiffStatus>;
|
let mut last_status = None::<DiffStatus>;
|
||||||
|
|
||||||
for (name, versions, status) in diffs {
|
for &(name, ref versions, status) in &diffs {
|
||||||
if last_status != Some(status) {
|
if last_status != Some(status) {
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
|
@ -255,5 +255,5 @@ pub fn write_diffln<'a>(
|
||||||
writeln!(writer)?;
|
writeln!(writer)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(diffs.len())
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ fn real_main() -> Result<()> {
|
||||||
writeln!(out)?;
|
writeln!(out)?;
|
||||||
|
|
||||||
#[expect(clippy::pattern_type_mismatch)]
|
#[expect(clippy::pattern_type_mismatch)]
|
||||||
dix::write_diffln(
|
let wrote = dix::write_diffln(
|
||||||
&mut out,
|
&mut out,
|
||||||
paths_old.iter().map(|(_, path)| path),
|
paths_old.iter().map(|(_, path)| path),
|
||||||
paths_new.iter().map(|(_, path)| path),
|
paths_new.iter().map(|(_, path)| path),
|
||||||
|
@ -144,7 +144,9 @@ fn real_main() -> Result<()> {
|
||||||
let size_new = size::Size::from_bytes(closure_size_new);
|
let size_new = size::Size::from_bytes(closure_size_new);
|
||||||
let size_diff = size_new - size_old;
|
let size_diff = size_new - size_old;
|
||||||
|
|
||||||
|
if wrote > 0 {
|
||||||
writeln!(out)?;
|
writeln!(out)?;
|
||||||
|
}
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
out,
|
out,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue