aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-remote-gcrypt
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-09-19 12:03:33 -0400
committerJoey Hess <joey@kitenet.net>2013-09-19 12:03:33 -0400
commit83d519179f5611641802b5de2b5f3f155798f61a (patch)
tree4404d935ea45196d7f204bebfa1d5e6e2c0b7fb5 /git-remote-gcrypt
parent243671037f5a36596187554712d7ed1e76e9c8b8 (diff)
downloadgit-remote-gcrypt-83d519179f5611641802b5de2b5f3f155798f61a.tar.gz
--check option to see if a repo exists and can be decrypted
This is to allow programs to determine if a repo uses gcrypt, per #6. Since this program already knows the name of the manifest file and how to download it and decrypt it, it makes sense to do the check here rather than in, eg, git-annex.
Diffstat (limited to 'git-remote-gcrypt')
-rwxr-xr-xgit-remote-gcrypt33
1 files changed, 25 insertions, 8 deletions
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