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.
This commit is contained in:
Matthias Beyer 2016-09-05 14:13:16 +02:00
parent 737aab80dc
commit 6a1ffe059b

View file

@ -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((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()))),
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()))),
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 {