[PATCH] Die w/ message if overwriting from pipe w/o force

jake jake at jakejohns.net
Thu Jan 11 04:12:41 CET 2018


The following (inserting "b") should fail:
> $ echo "a" | pass insert -e foo
> $ echo "b" | pass insert -e foo

Signed-off-by: jake <jake at jakejohns.net>
---
 src/password-store.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/password-store.sh b/src/password-store.sh
index e3cd145..2d0cd06 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -428,6 +428,7 @@ cmd_insert() {
 	check_sneaky_paths "$path"
 	set_git "$passfile"
 
+	[[ $force -eq 0 && -e $passfile && ! -t 0 ]] && die "An entry already exists for $path."
 	[[ $force -eq 0 && -e $passfile ]] && yesno "An entry already exists for $path. Overwrite it?"
 
 	mkdir -p -v "$PREFIX/$(dirname -- "$path")"
-- 
2.15.1



More information about the Password-Store mailing list