diff options
-rw-r--r-- | README.rst | 20 | ||||
-rwxr-xr-x | git-remote-gcrypt | 40 |
2 files changed, 46 insertions, 14 deletions
@@ -60,10 +60,13 @@ The following ``git-config(1)`` variables are supported: The ``gcrypt-participants`` setting on the remote takes precedence over the repository variable ``gcrypt.participants``. +``remote.<name>.gcrypt-signingkey`` + .. ``user.signingkey`` - (From regular git configuration) The key to use for signing. You - should set ``user.signingkey`` if your default signing key is not - part of the participant list. + (The latter from regular git configuration) The key to use for signing. + You should set ``user.signingkey`` if your default signing key is not + part of the participant list. You may use the per-remote version + to sign different remotes using different keys. Environment Variables ===================== @@ -170,6 +173,17 @@ Each item extends until newline, and matches one of the following: ``extn <name> ...`` Extension field, preserved but unused. +Detecting gcrypt repos +====================== + +To detect if a git url is a gcrypt repo, use: git-remote-gcrypt --check url +Exit status if 0 if the repo exists and can be decrypted, 1 if the repo +uses gcrypt but could not be decrypted, and 100 if the repo is not +encrypted with gcrypt (or could not be accessed). + +Note that this has to fetch the repo contents into the local git +repository, the same as is done when using a gcrypt repo. + See Also ======== diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 94e7d58..87db2a1 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -313,7 +313,7 @@ CLEAN_FINAL() ENCRYPT() { - gpg --batch --force-mdc --compress-algo none --passphrase-fd 3 -c 3<<EOF + gpg --batch --force-mdc --compress-algo none --trust-model=always --passphrase-fd 3 -c 3<<EOF $1 EOF } @@ -333,7 +333,7 @@ PRIVENCRYPT() if isnonnull "$Conf_signkey"; then set -- "$@" -u "$Conf_signkey" fi - gpg --compress-algo none -se "$@" + gpg --compress-algo none --trust-model=always -se "$@" } # $1 is the match for good signature, $2 is the textual signers list @@ -389,7 +389,8 @@ make_new_repo() read_config() { local recp_= r_keyinfo= r_keyfpr= gpg_list= cap_= conf_part= good_sig= signers_= - Conf_signkey=$(git config --path user.signingkey || :) + Conf_signkey=$(git config --get "remote.$NAME.gcrypt-signingkey" '.+' || + git config --path user.signingkey || :) conf_part=$(git config --get "remote.$NAME.gcrypt-participants" '.+' || git config --get gcrypt.participants '.+' || :) @@ -783,14 +784,8 @@ cleanup_tmpfiles() rm -r -f -- "${Tempdir}" >&2 } -# handle git-remote-helpers protocol -gcrypt_main_loop() +setup() { - local input_= input_inner= r_args= temp_key= - - NAME=$1 # Remote name - URL=$2 # Remote URL - mkdir -p "$Localdir" # Set up a subdirectory in /tmp @@ -802,6 +797,17 @@ gcrypt_main_loop() trap 'exit 1' 1 2 3 15 echo_info "Development version -- Repository format MAY CHANGE" +} + +# handle git-remote-helpers protocol +gcrypt_main_loop() +{ + local input_= input_inner= r_args= temp_key= + + NAME=$1 # Remote name + URL=$2 # Remote URL + + setup while read input_ do @@ -853,4 +859,16 @@ gcrypt_main_loop() done } -gcrypt_main_loop "$@" +if [ "x$1" = x--check ] +then + NAME=dummy-gcrypt-check + URL=$2 + setup + ensure_connected + if iseq "$Did_find_repo" "no" + then + exit 100 + fi +else + gcrypt_main_loop "$@" +fi |