Supress git errors when the pass store is not a git repo
This commit is contained in:
parent
f9902f8989
commit
ca322277b2
16
gocrypt.bash
16
gocrypt.bash
|
@ -32,6 +32,10 @@ gocrypt_die() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cmd_git() {
|
||||||
|
[ -d '.git' ] && cmd_git "$@"
|
||||||
|
}
|
||||||
|
|
||||||
gocrypt_derive_password() {
|
gocrypt_derive_password() {
|
||||||
local data="$1"
|
local data="$1"
|
||||||
local key="$2"
|
local key="$2"
|
||||||
|
@ -94,10 +98,10 @@ gocrypt_init() {
|
||||||
echo "# Gocrypt" >> .gitignore
|
echo "# Gocrypt" >> .gitignore
|
||||||
echo "gocrypt" >> .gitignore
|
echo "gocrypt" >> .gitignore
|
||||||
|
|
||||||
cmd_git add .gitignore
|
_cmd_git add .gitignore
|
||||||
$needs_passphrase && cmd_git add "$gocrypt_needs_passphrase_marker"
|
$needs_passphrase && _cmd_git add "$gocrypt_needs_passphrase_marker"
|
||||||
cmd_git add "$gocrypt_dir"
|
_cmd_git add "$gocrypt_dir"
|
||||||
cmd_git commit -m "Initialized encrypted storage for gocrypt plugin"
|
_cmd_git commit -m "Initialized encrypted storage for gocrypt plugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
gocrypt_open() {
|
gocrypt_open() {
|
||||||
|
@ -134,8 +138,8 @@ gocrypt_delegate() {
|
||||||
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
|
# Delegate command to another `pass` instance that manages what is inside of the mountpoint
|
||||||
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" "$PROGRAM" "$@"
|
PASSWORD_STORE_DIR="$PWD/$gocrypt_dec_dir" "$PROGRAM" "$@"
|
||||||
# Commit if there has been changes due to this operation
|
# Commit if there has been changes due to this operation
|
||||||
cmd_git add "$gocrypt_dir"
|
_cmd_git add "$gocrypt_dir"
|
||||||
cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
|
_cmd_git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
|
||||||
}
|
}
|
||||||
|
|
||||||
gocrypt_crypt() {
|
gocrypt_crypt() {
|
||||||
|
|
Loading…
Reference in a new issue