Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync: fix null handling when updating filepaths/metadata (#501)
Before this commit, when updating a `.meta/config.json` file that contained an optional key with the value of `null`, configlet would produce an `UnpackDefect`. For example, the below tries to update a file that contains `"contributors": null`: $ git clone https://github.com/exercism/common-lisp $ cd common-lisp $ git checkout 4fc524e24a69 $ configlet sync --metadata -e binary -u Checking exercises... Cloning https://github.com/exercism/problem-specifications/... success [warn] metadata: unsynced: binary sync the above metadata ([y]es/[n]o)? y options.nim(194) get Error: unhandled exception: Can't obtain a value from a `none` [UnpackDefect] `configlet fmt` removes optional key/value pairs when the value is `null`, and only the Common Lisp and Julia tracks had such a value, but `configlet sync -u` should still handle this situation properly. The bug: our `pretty` proc serializes from a list of keys, and relied on optional values being non-null. `configlet fmt` added only keys with non-null values to that list, but `configlet sync` tried to preserve null values to reduce noise in diffs. Fix by ensuring that `pretty` in sync mode can no longer sometimes use `get` with a `none`. Fixes: #500
- Loading branch information