[!exec:gpg] skip 'gpg not found in $PATH'
[githubactionsonwindows] skip 'gpg is broken in GitHub Actions on Windows'

mkhomedir
mkgpgconfig

# test that chezmoi add --encrypt encrypts
cp golden/.encrypted $HOME
chezmoi add --encrypt ${HOME}${/}.encrypted
exists $CHEZMOISOURCEDIR/encrypted_dot_encrypted
! grep plaintext $CHEZMOISOURCEDIR/encrypted_dot_encrypted

# test that chezmoi apply decrypts
rm $HOME/.encrypted
chezmoi apply --force
cmp golden/.encrypted $HOME/.encrypted

# test that chezmoi edit --apply transparently decrypts and re-encrypts
chezmoi edit --apply --force $HOME${/}.encrypted
grep '# edited' $HOME/.encrypted

-- golden/.encrypted --
plaintext
