Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin/toml: require sentinel "_" key in dec

The TOML encoder wraps bare scalars in a single-key table with the
sentinel key "_", and the decoder used to unwrap any single-member
table. That collapsed legitimate single-key tables through the round
trip. Restrict the unwrap to the exact sentinel shape so real single-
key tables stay as tables and [parse] can expose them as Named
children.

+5 -1
+5 -1
lib/toml/irmin_toml.ml
··· 14 14 let wrapped = Toml.Value.Table ([ (("_", meta), v) ], meta) in 15 15 Toml.to_string Toml.Value.codec wrapped 16 16 17 + (* Scalars round-trip through an [enc]-wrapped TOML document whose single 18 + member is keyed with the sentinel "_" (see [enc]). Only that exact shape 19 + is unwrapped here; tables with a real single key must stay as tables so 20 + [parse] can expose them as [Named] children. *) 17 21 let dec (s : string) : Toml.Value.t = 18 22 match Toml.of_string Toml.Value.codec s with 19 - | Ok (Toml.Value.Table ([ ((_, _), v) ], _)) -> v 23 + | Ok (Toml.Value.Table ([ (("_", _), v) ], _)) -> v 20 24 | Ok v -> v 21 25 | Error _ -> Toml.Value.Table ([], meta) 22 26