summaryrefslogtreecommitdiffstats
path: root/libimagref
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-09-05 14:13:16 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-09-05 16:15:40 +0200
commit6a1ffe059b418ed8838c193e01d83ebaafcacb63 (patch)
treef2161f2a1d0ba35c8a33f187258428263f5c84b7 /libimagref
parent737aab80dc029315d412ff781f20e9afd8db55ae (diff)
This patch puts the hasher name in the header
This was a bug, as the previous implementation simply sets the hash, but we need to set the hash in a place where we can re-find it with a hasher.
Diffstat (limited to 'libimagref')
-rw-r--r--libimagref/src/reference.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/libimagref/src/reference.rs b/libimagref/src/reference.rs
index fabb26a5..ba01f341 100644
--- a/libimagref/src/reference.rs
+++ b/libimagref/src/reference.rs
@@ -168,13 +168,17 @@ impl<'a> Ref<'a> {
};
for tpl in [
- Some(("ref", Value::Table(BTreeMap::new()))),
- Some(("ref.permissions", Value::Table(BTreeMap::new()))),
-
- Some(("ref.path", Value::String(canonical_path))),
-
- content_hash.map(|h| ("ref.content_hash", Value::String(h))),
- permissions.map(|p| ("ref.permissions.ro", Value::Boolean(p.readonly()))),
+ Some((String::from("ref"), Value::Table(BTreeMap::new()))),
+ Some((String::from("ref.permissions"), Value::Table(BTreeMap::new()))),
+ Some((String::from("ref.path"), Value::String(canonical_path))),
+ Some((String::from("ref.content_hash"), Value::Table(BTreeMap::new()))),
+
+ content_hash.map(|hash| {
+ (format!("ref.content_hash.{}", h.hash_name()), Value::String(hash))
+ }),
+ permissions.map(|p| {
+ (String::from("ref.permissions.ro"), Value::Boolean(p.readonly()))
+ }),
].into_iter()
{
match tpl {