pluralsh / plural-cli

cli for the plural platform
MIT License
27 stars 10 forks source link

Minor bug fix: don't write empty encrypted files, they confuse Git #401

Closed maciejp-ro closed 1 year ago

maciejp-ro commented 1 year ago

Summary

I bumped into a quirk with Git encryption filter: for some reason, git diff --stat and family doesn't call textconv if the decrypted file in repo is empty. It compares the decrypted empty file with encrypted file in repo, which results in a permanent phantom diff.

Which would be a minor quirk, but git diff --shortstat is what my zsh prompt calls to get summary, which means my shell thinks there are some changes and my prompt is red, which is personally annoying.

Liquidprompt is quite popular and it's likely that other similar status tools for shells, editors and such are confused.

All the empty files (so far) were values.yaml in Helm directories. This PR lets yaml.Marshal write {} into the values file, which makes the files not empty and fixes the diff.

Drive-by fix: one unrelated test was failing for me because of a symlink in $TMPDIR (AFAIK a normal thing in MacOS), fixed that too.

Labels

bug-fix

Test Plan

Ran plural build in my repository, ran make test

Checklist

maciejp-ro commented 1 year ago

(I cannot add actual labels to the PR, but added them in the body as suggested by the PR template)

michaeljguarino commented 1 year ago

Thanks for taking this on, we'll get it out and released asap