aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-11-25 23:47:52 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-11-25 23:47:52 +0200
commitbfdfc096ae53a8866c3b2bdc0406d8595b4597b5 (patch)
treeb41b7e32653b8a8a9fd133413fdf4994844a823e
parentfe2a51024a623ab288ca6d9c6b8b492399e06eb4 (diff)
downloadgit-gpgcrypt-bfdfc096ae53a8866c3b2bdc0406d8595b4597b5.tar.gz
Support both whole-line and line-trailing comments.
Whole-line comments are obviosuly useful, and trailing lines useful to annotate specific recipient (e.g., with readable identifier, if recipient is given via key ID). Change-Id: I09901daaa910f39889470956d9d9c94e14df77e3
-rwxr-xr-xgit-gpgcrypt9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-gpgcrypt b/git-gpgcrypt
index 1c3c076..caef5bc 100755
--- a/git-gpgcrypt
+++ b/git-gpgcrypt
@@ -95,8 +95,13 @@ get_salt() {
cat .gpgcrypt-salt
}
+get_recipients() {
+ # Filter lines starting with "#" and trailing "# <text>" in lines
+ grep -E "^[^#]" .recipients | sed -r -e 's/ +#[^#]*//'
+}
+
encrypt_key() {
- echo "$1" | gpg -ea --group gr="$(sed -r -e 's/ +#[^#]*//' .recipients | tr '\n' ' ')" -r gr --output .gpgcrypt-key.tmp
+ echo "$1" | gpg -ea --group gr="$(get_recipients | tr '\n' ' ')" -r gr --output .gpgcrypt-key.tmp
mv .gpgcrypt-key.tmp .gpgcrypt-key
}
@@ -119,7 +124,7 @@ case "$1" in
echo "Press Enter if you are sure you want to continue or Ctrl+C to quit."
echo "!!!!! WARNING !!!!!"
read
- sed -r -e 's/ +#[^#]*//' .recipients | xargs -d "\n" -n1 gpg --keyserver keyserver.ubuntu.com --search-keys
+ get_recipients | xargs -d "\n" -n1 gpg --keyserver keyserver.ubuntu.com --search-keys
;;
clean)
#gpg -ea --group gr="$(cat .recipients|tr '\n' ' ')" -r gr