From 75855a5e883904a093e4f75b8e724297d7d4c7d4 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Mon, 10 Oct 2022 20:27:27 -0400 Subject: [PATCH] Reduce output noise when delegated command made no change --- gocrypt.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gocrypt.bash b/gocrypt.bash index d5bf021..e6c96f4 100755 --- a/gocrypt.bash +++ b/gocrypt.bash @@ -130,8 +130,10 @@ gocrypt_delegate() { # Delegate command to another `pass` instance that manages what is inside of the mountpoint PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" "$PROGRAM" "$@" # Commit if there has been changes due to this operation - _cmd_git add "$gocrypt_dir" - _cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created" + if [[ `_cmd_git status --porcelain=v1 "$gocrypt_dir"` ]]; then + _cmd_git add "$gocrypt_dir" + _cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created" + fi } gocrypt_crypt() {