diff options
author | root <root@localhost> | 2013-02-14 00:00:00 +0000 |
---|---|---|
committer | root <root@localhost> | 2013-02-14 00:00:00 +0000 |
commit | 677df0e31bcb10f2b1002f6e8f1148051ae34e3d (patch) | |
tree | 2138b45db560dfcd3c296bcf666e5d2c7ea1a9cf | |
parent | 68ff0eb7c46b30fb8499d8aaf39c961e131a4eee (diff) | |
download | git-remote-gcrypt-677df0e31bcb10f2b1002f6e8f1148051ae34e3d.zip git-remote-gcrypt-677df0e31bcb10f2b1002f6e8f1148051ae34e3d.tar.gz git-remote-gcrypt-677df0e31bcb10f2b1002f6e8f1148051ae34e3d.tar.bz2 |
Use rsync for both rsync and ssh access
-rw-r--r-- | README.rst | 8 | ||||
-rwxr-xr-x | git-remote-gcrypt | 37 |
2 files changed, 18 insertions, 27 deletions
@@ -16,7 +16,7 @@ Remote helper programs are invoked by git to handle network transport. 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. @@ -39,10 +39,10 @@ Quickstart :: - 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::[...] @@ -88,7 +88,7 @@ Examples :: 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:: diff --git a/git-remote-gcrypt b/git-remote-gcrypt index c912f99..5011706 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -142,11 +142,7 @@ gitception_new_repo() # 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" @@ -163,11 +159,7 @@ GET() # 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" @@ -184,7 +176,7 @@ PUT() # 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 @@ -195,11 +187,7 @@ PUT_FINAL() # 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" @@ -217,11 +205,7 @@ PUTREPO() 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" @@ -231,7 +215,9 @@ REMOVE() --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_" @@ -241,7 +227,7 @@ REMOVE() 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 @@ -388,6 +374,11 @@ ensure_connected() 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" || { |