summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-mirror19
-rw-r--r--git-mirror.conf.example3
2 files changed, 10 insertions, 12 deletions
diff --git a/git-mirror b/git-mirror
index 521576e..ed69ac3 100755
--- a/git-mirror
+++ b/git-mirror
@@ -37,11 +37,10 @@ main() {
handle-repo() {
[[ $# == 1 ]] || panic
local repo=$1
- local local url upstream downstreams downstream r=0
+ local local upstream downstreams downstream r=0
# read configuration
local="$(cfg-get "repo.$repo.local")"
- url="$(cfg-get "repo.$repo.url")" || true
upstream="$(cfg-get "repo.$repo.upstream")" || true
downstreams=($(cfg-get-all "repo.$repo.downstream")) || true
@@ -55,7 +54,7 @@ handle-repo() {
# upload
for downstream in "${downstreams[@]}"; do
- upload "$url" "$local" "$downstream" || r=$?
+ upload "$local" "$downstream" || r=$?
done
return $r
@@ -83,15 +82,15 @@ download() {
}
upload() {
- [[ $# == 3 ]] || panic
- local clonable_url=$1
- local local=$2
- local remote=$3
+ [[ $# == 2 ]] || panic
+ local local=$1
+ local remote=${2%%#*}
+ local IFS='&'
+ local params=(${2#"$remote"})
# push metadata
{
- printf '%q ' set-meta "${remote#*:}"
- [[ -z "$clonable_url" ]] || printf '%q ' "mirror=$clonable_url"
+ printf '%q ' set-meta "${remote#*:}" "${params[@]}"
git config --file "$local/config" --get-regexp '^git-mirror[.]' -z|sed -z 's/ /=/'|xargs -0r printf '%q '
} | account "${remote%%:*}"
# push repository
@@ -121,7 +120,7 @@ account() {
# `account` is awkward to use; so let's wrap it.
remote() {
[[ $# > 1 ]] || panic
- local remote=$1
+ local remote=${1%%#*}
[[ $remote = *:* ]]
local account="${remote%%:*}"
diff --git a/git-mirror.conf.example b/git-mirror.conf.example
index 8f34dc1..722f00d 100644
--- a/git-mirror.conf.example
+++ b/git-mirror.conf.example
@@ -22,6 +22,5 @@
[repo "abslibre/abslibre"]
upstream = parabola:abslibre/abslibre.git
local = abslibre/abslibre.git
- url = https://git.parabola.nu/abslibre/abslibre.git
- downstream = gitlab:parabola/abslibre_abslibre
+ downstream = gitlab:parabola/abslibre_abslibre#mirror=https://git.parabola.nu/abslibre/abslibre.git&name=abslibreā•±abslibre
downstream = github:parabola/abslibre_abslibre