aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst11
-rwxr-xr-xgit-remote-gcrypt43
2 files changed, 32 insertions, 22 deletions
diff --git a/README.rst b/README.rst
index 8b84d0e..ffd5a81 100644
--- a/README.rst
+++ b/README.rst
@@ -16,12 +16,13 @@ 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://` and `sftp://`, where the
-repository is stored as a set of files. If the location instead is any
-`<giturl>`, gcrypt will store the same representation in a git
-repository, and so it can be bridged over any git transport.
+Supported locations are `local`, `ssh://`, `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.
-.. NOTE:: Repository format MAY STILL change, incompatibly
+.. NOTE:: Repository format MAY STILL change, incompatibly. We may
+ not continue to support all types of remote transport.
Quickstart
..........
diff --git a/git-remote-gcrypt b/git-remote-gcrypt
index e7a435c..89308c7 100755
--- a/git-remote-gcrypt
+++ b/git-remote-gcrypt
@@ -121,46 +121,52 @@ gitception_new_repo()
}
## end gitception
-# Fetch repo $1, file $2
+# Fetch repo $1, file $2, tmpfile in $3
GET()
{
if isurl ssh "$1"
then
splitcolon "${1#ssh://}"
- (exec 0>&-; ssh "$prefix_" "cat $suffix_/$2")
+ (exec 0>&-; ssh "$prefix_" "cat $suffix_/$2") > "$3"
elif isurl sftp "$1"
then
- (exec 0>&-; curl -s -S -k "$1/$2")
+ (exec 0>&-; curl -s -S -k "$1/$2") > "$3"
+ elif isurl rsync "$1"
+ then
+ (exec 0>&-; rsync -I -W "${1#rsync://}"/"$2" "$3" >&2)
elif islocalrepo "$1"
then
- cat "$1/$2"
+ cat "$1/$2" > "$3"
else
- gitception_get "${1#gitception://}" "$2"
+ gitception_get "${1#gitception://}" "$2" > "$3"
fi
}
-# Put repo $1, file $2 or fail
+# Put repo $1, file $2 or fail, tmpfile in $3
PUT()
{
if isurl ssh "$1"
then
splitcolon "${1#ssh://}"
- ssh "$prefix_" "cat > $suffix_/$2"
+ ssh "$prefix_" "cat > $suffix_/$2" < "$3"
elif isurl sftp "$1"
then
- curl -s -S -k --ftp-create-dirs -T - "$1/$2"
+ curl -s -S -k --ftp-create-dirs -T "$3" "$1/$2"
+ elif isurl rsync "$1"
+ then
+ rsync -I -W "$3" "${1#rsync://}"/"$2" >&2
elif islocalrepo "$1"
then
- cat > "$1/$2"
+ cat > "$1/$2" < "$3"
else
- gitception_put "${1#gitception://}" "$2"
+ gitception_put "${1#gitception://}" "$2" < "$3"
fi
}
# Put all PUT changes for repo $1 at once
PUT_FINAL()
{
- if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1"
+ if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
then
:
else
@@ -178,6 +184,9 @@ PUTREPO()
elif isurl sftp "$1"
then
:
+ elif isurl rsync "$1"
+ then
+ rsync -q -r --exclude='*' "$Localdir/" "${1#rsync://}" >&2
elif islocalrepo "$1"
then
mkdir -p "$1"
@@ -188,7 +197,7 @@ PUTREPO()
CLEAN_FINAL()
{
- if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1"
+ if isurl ssh "$1" || isurl sftp "$1" || islocalrepo "$1" || isurl rsync "$1"
then
:
else
@@ -330,7 +339,7 @@ ensure_connected()
TmpManifest_Enc="$Localdir/manifest.$$"
trap 'rm -f "$TmpManifest_Enc"' EXIT
- GET "$URL" "$Repoid" 2>/dev/null > "$TmpManifest_Enc" ||
+ GET "$URL" "$Repoid" "$TmpManifest_Enc" 2>/dev/null ||
echo_die "Repository not found: $url_id at $URL"
Did_find_repo=yes
@@ -413,8 +422,8 @@ do_fetch()
do
isnonnull "$packline_" || continue
pack_=${packline_#"$Packpfx"}
- rcv_id="$(GET "$URL" "$pack_" | \
- tee "$TmpPack_Encrypted" | pack_hash)"
+ GET "$URL" "$pack_" "$TmpPack_Encrypted"
+ rcv_id=$(pack_hash < "$TmpPack_Encrypted")
if isnoteq "$rcv_id" "$pack_"
then
echo_die "Packfile $pack_ does not match digest!"
@@ -490,7 +499,7 @@ EOF
then
pack_id=$(pack_hash < "$TmpPack_Encrypted")
Packlist=$(append "$Packlist" "$Packpfx$pack_id $key_")
- PUT "$URL" "$pack_id" < "$TmpPack_Encrypted"
+ PUT "$URL" "$pack_id" "$TmpPack_Encrypted"
fi
rm -f "$TmpPack_Encrypted"
@@ -508,7 +517,7 @@ EOF
repoidstr; xecho "$Extension_list") |
PRIVENCRYPT "$Recipients" > "$TmpManifest_Enc"
- PUT "$URL" "$Repoid" < "$TmpManifest_Enc"
+ PUT "$URL" "$Repoid" "$TmpManifest_Enc"
PUT_FINAL "$URL"