This helper handles gcrypt:: URLs that will access a remote repository
encrypted with GPG, using our custom format.
-Supported locations are `local`, `ssh://`, `rsync://` and `sftp`, where
+Supported locations are `local`, `rsync://` and `sftp://`, where
the repository is stored as a set of files, or instead any `<giturl>`
where gcrypt will store the same representation in a git repository,
bridged over arbitrary git transport.
::
- git remote add cryptremote gcrypt::ssh://example.com:repo
+ git remote add cryptremote gcrypt::rsync://example.com:repo
git push cryptremote master
> gcrypt: Setting up new repository
- > gcrypt: Repository URL is gcrypt::ssh://example.com:repo#KNBr0wKzct52
+ > gcrypt: Repository URL is gcrypt::rsync://example.com:repo#KNBr0wKzct52
> gcrypt: (configuration for cryptremote updated)
> [ more lines .. ]
> To gcrypt::[...]
::
git config gcrypt.participants YOURKEYID
- git remote add cryptremote gcrypt::ssh://example.com:repo
+ git remote add cryptremote gcrypt::rsync://example.com:repo
git push cryptremote HEAD
How to use a git backend::
# Fetch repo $1, file $2, tmpfile in $3
GET()
{
- if isurl ssh "$1"
- then
- splitcolon "${1#ssh://}"
- (exec 0>&-; ssh "$prefix_" "cat $suffix_/$2") > "$3"
- elif isurl sftp "$1"
+ if isurl sftp "$1"
then
(exec 0>&-; curl -s -S -k "$1/$2") > "$3"
elif isurl rsync "$1"
# Put repo $1, file $2 or fail, tmpfile in $3
PUT()
{
- if isurl ssh "$1"
- then
- splitcolon "${1#ssh://}"
- ssh "$prefix_" "cat > $suffix_/$2" < "$3"
- elif isurl sftp "$1"
+ if isurl sftp "$1"
then
curl -s -S -k --ftp-create-dirs -T "$3" "$1/$2"
elif isurl rsync "$1"
# Put all PUT changes for repo $1 at once
PUT_FINAL()
{
- if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
+ if isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
then
:
else
# Put directory for repo $1
PUTREPO()
{
- if isurl ssh "$1"
- then
- splitcolon "${1#ssh://}"
- (exec 0>&- ; ssh "$prefix_" "mkdir -p $suffix_")
- elif isurl sftp "$1"
+ if isurl sftp "$1"
then
:
elif isurl rsync "$1"
REMOVE()
{
local fn_=
- if isurl ssh "$1"
- then
- splitcolon "${1#ssh://}"
- (exec 0>&- ; ssh "$prefix_" "cd $suffix_; rm $2")
- elif isurl sftp "$1"
+ if isurl sftp "$1"
then
# FIXME
echo_info "sftp: Ignore remove request $1/$2"
--exclude='*' "$Localdir"/ "${1#rsync://}/" >&2
elif islocalrepo "$1"
then
- (cd "$1"; rm $2)
+ for fn_ in $2; do
+ rm -f "$1"/"$fn_"
+ done
else
for fn_ in $2; do
gitception_remove "${1#gitception://}" "$fn_"
CLEAN_FINAL()
{
- if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
+ if isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
then
:
else
Did_find_repo=no
read_config
+ # Fixup ssh:// -> rsync://
+ if isurl ssh "$URL"; then
+ URL="rsync://${URL#ssh://}"
+ fi
+
# split out Repo ID from URL
url_id=${URL##*"#"}
isnoteq "$url_id" "$URL" || {