sync: fix null handling when updating filepaths/metadata #501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For now, let's resolve the problem by stripping any optional key withthe value of
null
when updating filepaths or metadata.Edit: Okay, I've tried to keep preserving the
null
duringsync
(fmt
strips it).Before this commit, when updating a
.meta/config.json
file thatcontained an optional key with the value of
null
, configlet wouldproduce an
UnpackDefect
. For example, the below tries to update afile that contains
"contributors": null
:configlet fmt
removes optional key/value pairs when the value isnull
, and only the Common Lisp and Julia tracks had such a value, butconfiglet sync -u
should still handle this situation properly.The bug: our
pretty
proc serializes from a list of keys, and relied onoptional values being non-null.
configlet fmt
added only keys withnon-null values to that list, but
configlet sync
tried to preservenull values to reduce noise in diffs.
Fix by ensuring that
pretty
in sync mode can no longer sometimes useget
with anone
.Fixes: #500