aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.rst14
-rwxr-xr-xgit-remote-gcrypt14
2 files changed, 18 insertions, 10 deletions
diff --git a/README.rst b/README.rst
index 097c05c..a86d567 100644
--- a/README.rst
+++ b/README.rst
@@ -40,7 +40,7 @@ Quickstart
Create an encrypted remote by pushing to it::
- git remote add cryptremote gcrypt::rsync://example.com:repo
+ git remote add cryptremote gcrypt::rsync://example.com/repo
git push cryptremote master
> gcrypt: Setting up new repository
> gcrypt: Remote ID is :id:7VigUnLVYVtZx8oir34R
@@ -116,7 +116,7 @@ Examples
How to set up a remote for two participants::
- git remote add cryptremote gcrypt::rsync://example.com:repo
+ git remote add cryptremote gcrypt::rsync://example.com/repo
git config remote.cryptremote.gcrypt-participants "KEY1 KEY2"
git push cryptremote master
@@ -163,10 +163,12 @@ Performance
repository hosting service like Gitolite, GitHub or GitLab.
rsync URIs
- Note that the URI format for the rsync backend is, regretably,
- non-standard. git-remote-gcrypt uses ``rsync://user@host:path``
- whereas plain rsync uses either ``user@host:path`` or
- ``rsync://user@host/path``.
+ The URI format for the rsync backend is ``rsync://user@host/path``,
+ which translates to the rsync location ``user@host:/path``,
+ accessed over ssh. Note that the path is absolute, not relative to the
+ home directory. An earlier non-standard URI format is also supported:
+ ``rsync://user@host:path``, which translates to the rsync location
+ ``user@host:path``
rclone backend
In addition to adding the rclone backend as a remote with URI like
diff --git a/git-remote-gcrypt b/git-remote-gcrypt
index 5c15b60..c519bf8 100755
--- a/git-remote-gcrypt
+++ b/git-remote-gcrypt
@@ -149,6 +149,12 @@ line_count()
xecho "$#"
}
+# Convert URI in standard or nonstandard form to rsync's user@host:path
+rsynclocation ()
+{
+ echo "${1#rsync://}" | sed 's/\(^[^:/]*\)\//\1:\//'
+}
+
## gitception part
# Fetch giturl $1, file $2
@@ -229,7 +235,7 @@ GET()
(exec 0>&-; curl -s -S -k "$1/$2") > "$3"
elif isurl rsync "$1"
then
- (exec 0>&-; rsync -I -W "${1#rsync://}"/"$2" "$3" >&2)
+ (exec 0>&-; rsync -I -W "$(rsynclocation "$1")"/"$2" "$3" >&2)
elif isurl rclone "$1"
then
(exec 0>&-; rclone copyto "${1#rclone://}"/"$2" "$3" >&2)
@@ -249,7 +255,7 @@ PUT()
curl -s -S -k --ftp-create-dirs -T "$3" "$1/$2"
elif isurl rsync "$1"
then
- rsync $Conf_rsync_put_flags -I -W "$3" "${1#rsync://}"/"$2" >&2
+ rsync $Conf_rsync_put_flags -I -W "$3" "$(rsynclocation "$1")"/"$2" >&2
elif isurl rclone "$1"
then
rclone copyto "$3" "${1#rclone://}"/"$2" >&2
@@ -281,7 +287,7 @@ PUTREPO()
elif isurl rsync "$1"
then
rsync $Conf_rsync_put_flags -q -r --exclude='*' \
- "$Localdir/" "${1#rsync://}" >&2
+ "$Localdir/" "$(rsynclocation "$1")" >&2
elif isurl rclone "$1"
then
rclone mkdir "${1#rclone://}" >&2
@@ -304,7 +310,7 @@ REMOVE()
elif isurl rsync "$1"
then
xfeed "$2" rsync -I -W -v -r --delete --include-from=- \
- --exclude='*' "$Localdir"/ "${1#rsync://}/" >&2
+ --exclude='*' "$Localdir"/ "$(rsynclocation "$1")/" >&2
elif isurl rclone "$1"
then
xfeed "$2" rclone delete -v --include-from=/dev/stdin "${1#rclone://}/" >&2