summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2023-06-18 18:03:50 +0200
committerMatthias Beyer <mail@beyermatthias.de>2023-07-02 20:32:08 +0200
commitbeeeaef4bc388f5f67687b995c317d41100d0ab9 (patch)
treeae9b5e3c84f4b76db9fef2edcd146da2e56b08cd
parent4b83ee5083f8889407683962ed3623a397e585e6 (diff)
Fix: Only consider fragment files
The previous implementation did consider non-changelog-fragment-files as well, which is not what we want here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/command/verify_metadata_command.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/command/verify_metadata_command.rs b/src/command/verify_metadata_command.rs
index 76a1e52..734a237 100644
--- a/src/command/verify_metadata_command.rs
+++ b/src/command/verify_metadata_command.rs
@@ -24,19 +24,25 @@ impl crate::command::Command for VerifyMetadataCommand {
Ok(de) => de.path().is_file().then(|| de.path().to_path_buf()).map(Ok),
Err(e) => Some(Err(e)),
})
- .map(|rde| -> Result<_, Error> {
- let de = rde.map_err(VerificationError::from)?;
+ .filter_map(|rde| {
+ let de = match rde {
+ Err(e) => return Some(Err(Error::from(VerificationError::from(e)))),
+ Ok(de) => de,
+ };
let path = de.as_path();
log::trace!("Looking at {}", path.display());
- if crate::command::common::get_version_from_path(path)
- .map_err(VerificationError::from)?
- .is_none()
+ match crate::command::common::get_version_from_path(path)
+ .map_err(VerificationError::from)
{
- log::warn!("No version: {}", path.display());
+ Err(e) => return Some(Err(Error::from(e))),
+ Ok(None) => return None,
+ Ok(_some) => {
+ // nothing
+ }
}
- std::fs::OpenOptions::new()
+ let res = std::fs::OpenOptions::new()
.read(true)
.create(false)
.write(false)
@@ -57,7 +63,9 @@ impl crate::command::Command for VerifyMetadataCommand {
multiple: errors,
})
})
- .map_err(|ve| Error::Verification(ve))
+ .map_err(|ve| Error::Verification(ve));
+
+ Some(res)
})
.partition_result();