Skip to content

Commit

Permalink
fix: Fix handling of comment instructions in apply
Browse files Browse the repository at this point in the history
  • Loading branch information
VorpalBlade committed Sep 19, 2024
1 parent 856e79a commit 331189d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion crates/konfigkoll_core/src/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ impl InProcessApplicator {
std::fs::write(&instr.path, contents)?;
}
}
FsOp::Comment => (),
FsOp::Comment => {
tracing::warn!(
"Ignoring comment instruction, we shouldn't ever get here: {:?}",
instr
);
}
};
Ok(())
}
Expand Down Expand Up @@ -577,6 +582,16 @@ pub fn apply_files(
if chunk[0].op == FsOp::Remove {
chunk.reverse();
};
// These make no sense during apply (only for save)
if chunk[0].op == FsOp::Comment {
tracing::warn!("There are entries in your config that are no longer needed:");
for instr in chunk {
if let Some(comment) = &instr.comment {
tracing::warn!(" * {}: {comment}", instr.path);
}
}
continue;
}
applicator
.apply_files(&*chunk)
.wrap_err("Error while applying files")?;
Expand Down

0 comments on commit 331189d

Please sign in to comment.