aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-09-19 12:10:23 -0400
committerJoey Hess <joey@kitenet.net>2013-09-19 12:10:23 -0400
commit4435ca5a96b313af2905c70b6cd31fcad212d8c9 (patch)
treeb8616e55c8f087336a0c24de15ee73640bdff54f
parent71155a20a9cf3813f0340e12496cfb42b2a4b7a4 (diff)
parent83d519179f5611641802b5de2b5f3f155798f61a (diff)
downloadgit-remote-gcrypt-4435ca5a96b313af2905c70b6cd31fcad212d8c9.tar.gz
Merge branch 'master' into dgit/sid
-rw-r--r--README.rst11
-rwxr-xr-xgit-remote-gcrypt33
2 files changed, 36 insertions, 8 deletions
diff --git a/README.rst b/README.rst
index 6fc4636..3922376 100644
--- a/README.rst
+++ b/README.rst
@@ -173,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 does not
+exist 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 bf75777..67b0f67 100755
--- a/git-remote-gcrypt
+++ b/git-remote-gcrypt
@@ -779,14 +779,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
@@ -798,6 +792,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
@@ -849,4 +854,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