m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 01:33:18 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2014-03-20 01:33:18 -0600
commit9ef311d868248682a11c8cb8c0177bc9949be7b9 (patch)
tree9a8a586ac152d99c160e104e4e6d307ff72dcea1
parent2e6e3fc07ed1a0ae56c653071aa1aaf6439cdafc (diff)
git: sign commits if enabled
-rw-r--r--man/pass.17
-rwxr-xr-xsrc/password-store.sh3
2 files changed, 7 insertions, 3 deletions
diff --git a/man/pass.1 b/man/pass.1
index 6555ca0..2b3e5e3 100644
--- a/man/pass.1
+++ b/man/pass.1
@@ -1,4 +1,4 @@
-.TH PASS 1 "2012 Sept 24" ZX2C4 "Password Store"
+.TH PASS 1 "2014 March 18" ZX2C4 "Password Store"
.SH NAME
pass - stores, retrieves, generates, and synchronizes passwords securely
@@ -118,7 +118,10 @@ If the password store is a git repository, pass \fIgit-command-args\fP as argume
.BR git (1)
using the password store as the git repository. If \fIgit-command-args\fP is \fBinit\fP,
in addition to initializing the git repository, add the current contents of the password
-store to the repository in an initial commit.
+store to the repository in an initial commit. If the git config key \fIpass.signcommits\fP
+is set to \fItrue\fP, then all commits will be signed using \fIuser.signingkey\fP or the
+default git signing key. This config key may be turned on using:
+.B `pass git config --bool --add pass.signcommits true`
.TP
\fBhelp\fP
Show usage message.
diff --git a/src/password-store.sh b/src/password-store.sh
index f7ad52b..a5d3374 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -69,7 +69,8 @@ git_add_file() {
[[ -d $GIT_DIR ]] || return
git add "$1" || return
[[ -n $(git status --porcelain "$1") ]] || return
- git commit -m "$2"
+ [[ $(git config --bool --get pass.signcommits) == "true" ]] && sign="-S" || sign=""
+ git commit $sign -m "$2"
}
yesno() {
read -r -p "$1 [y/N] " response