feat: set unused digest outputs to null based on method

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-27 17:42:55 -03:00
parent 430eafcf80
commit d013b60fc1

View File

@@ -166,6 +166,7 @@ impl MetaPlugin for DigestMetaPlugin {
let hash_value = hasher.finalize(); let hash_value = hasher.finalize();
let output_name = hasher.output_name(); let output_name = hasher.output_name();
// Add the selected hash output
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs( if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
output_name, output_name,
hash_value, hash_value,
@@ -173,6 +174,23 @@ impl MetaPlugin for DigestMetaPlugin {
) { ) {
metadata.push(meta_data); metadata.push(meta_data);
} }
// Set unused outputs to None
let unused_outputs: Vec<&str> = match hasher {
Hasher::Md5(_) => vec!["digest_sha256", "digest_sha512"],
Hasher::Sha256(_) => vec!["digest_md5", "digest_sha512"],
Hasher::Sha512(_) => vec!["digest_md5", "digest_sha256"],
};
for output_name in unused_outputs {
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
output_name,
serde_yaml::Value::Null,
&self.outputs
) {
metadata.push(meta_data);
}
}
} }
self.is_finalized = true; self.is_finalized = true;