[!exec:gpg] skip 'gpg not found in $PATH'

mkgpgconfig

cp golden/.encrypted $HOME/.encrypted

# test that chezmoi add adds a file unencrypted
chezmoi add $HOME${/}.encrypted
cmp $CHEZMOISOURCEDIR/dot_encrypted golden/.encrypted

# test that chezmoi add --encrypt encrypts the file in the source state
chezmoi add --encrypt $HOME${/}.encrypted
! exists $CHEZMOISOURCEDIR/dot_encrypted
exists $CHEZMOISOURCEDIR/encrypted_dot_encrypted.asc
grep '-----BEGIN PGP MESSAGE-----' $CHEZMOISOURCEDIR/encrypted_dot_encrypted.asc

# test that chezmoi add without --encrypt replaces the source file
chezmoi add --force $HOME${/}.encrypted
! exists $CHEZMOISOURCEDIR/encrypted_dot_encrypted.asc
cmp $CHEZMOISOURCEDIR/dot_encrypted golden/.encrypted

-- golden/.encrypted --
# contents of .encrypted
