8eba19208dfd62a0565e837a715e62d9876480a0

Author
Marc Cornellà <marc.cornella@live.com>
Committer
GitHub <noreply@github.com>
Date

Message

Revert to checking if `enable-ssh-support` is set

Fixes #6772

Diff

 1diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh
 2index 6a94f598f0097c140efdc45808664826043fb27b..3e24c25278a3d708da7e2db068e9fb54f8255dfa 100644
 3--- a/plugins/gpg-agent/gpg-agent.plugin.zsh
 4+++ b/plugins/gpg-agent/gpg-agent.plugin.zsh
 5@@ -1,16 +1,16 @@
 6 # Enable gpg-agent if it is not running-
 7 # --use-standard-socket will work from version 2 upwards
 8 
 9-AGENT_SOCK=`gpgconf --list-dirs | grep agent-socket | cut -d : -f 2`
10+AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
11 
12-if [ ! -S ${AGENT_SOCK} ]; then
13-  gpg-agent --daemon --use-standard-socket >/dev/null 2>&1
14+if [[ ! -S $AGENT_SOCK ]]; then
15+  gpg-agent --daemon --use-standard-socket &>/dev/null
16 fi
17-export GPG_TTY=$(tty)
18+export GPG_TTY=$TTY
19 
20 # Set SSH to use gpg-agent if it's enabled
21-if [ -S "${AGENT_SOCK}.ssh" ]; then
22-  export SSH_AUTH_SOCK="${AGENT_SOCK}.ssh"
23+GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
24+if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
25+  export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
26   unset SSH_AGENT_PID
27 fi
28-