diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-12-15 04:05:15 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-12-15 04:05:15 -0500 |
commit | 1c283ae4872218265c97785d17bb4b16aea93cb3 (patch) | |
tree | 03740200c0aafca5ae46aca8f8a9f18dd8c2aeee | |
parent | b7b7eec509ee24655b17485fae702e2bd96b5835 (diff) |
Allow meta data to be configured as URL fragments
-rwxr-xr-x | git-mirror | 19 | ||||
-rw-r--r-- | git-mirror.conf.example | 3 |
2 files changed, 10 insertions, 12 deletions
@@ -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 |