diff options
author | root <root@localhost> | 2013-02-14 00:00:00 +0000 |
---|---|---|
committer | root <root@localhost> | 2013-02-14 00:00:00 +0000 |
commit | 543ca8602909cdbfe1ac25c304bd3418756bab76 (patch) | |
tree | c767ee9b3c808ccbfab6fcae77cbde7a1fd4cc39 /git-remote-gcrypt | |
parent | aa4b80db7fd8b3b46a8331bde66d3525712f46a7 (diff) | |
download | git-remote-gcrypt-543ca8602909cdbfe1ac25c304bd3418756bab76.tar.gz |
Only encrypt to keys with encrypt capability
Diffstat (limited to 'git-remote-gcrypt')
-rwxr-xr-x | git-remote-gcrypt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 6c380da..49fed5f 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -257,10 +257,14 @@ safe_git_rev_parse() check_recipients() { - Recipients="$(gpg --no-default-keyring --keyring "$Conf_keyring" \ - --with-colons -k | xgrep ^pub | cut -f 5 -d ':' | tr '\n' ' ')" - # Split recipients by space, example "a b c" => -R a -R b -R c - Recipients=$(xecho_n "$Recipients" | sed -e 's/\([^ ]\+\)/-R &/g') + # Find which keys in the keyring we can encrypt to + Recipients=$(gpg --no-default-keyring --keyring "$Conf_keyring" \ + --with-colons --fast-list -k | xgrep ^pub | \ + while read rc_line; do + cap_=$(xecho "$rc_line" | cut -f 12 -d :) + keyid_=$(xecho "$rc_line" | cut -f 5 -d :) + iseq "${cap_#*E}" "$cap_" || xecho_n "-R $keyid_ " + done) if isnull "$Recipients" then echo_info "You must configure a keyring for the repository." |