aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKylie McClain <kylie@somas.is>2020-07-01 05:47:14 -0400
committerKylie McClain <kylie@somas.is>2020-07-01 05:47:14 -0400
commit19e74612235cc572a8ea119a40ce98b87e976601 (patch)
tree5051956717995ab29031023f26260a9a1dd41a1d
parentad38d0f1bd8e8a645e0bb710e9a275dab9e63f07 (diff)
downloadgitolite-admin-19e74612235cc572a8ea119a40ce98b87e976601.tar.gz
gitolite-admin-19e74612235cc572a8ea119a40ce98b87e976601.tar.xz
gitolite-admin-19e74612235cc572a8ea119a40ce98b87e976601.zip
push-to-mirror: port to execline
-rwxr-xr-xlocal/hooks/repo-specific/push-to-mirror32
1 files changed, 14 insertions, 18 deletions
diff --git a/local/hooks/repo-specific/push-to-mirror b/local/hooks/repo-specific/push-to-mirror
index cbd7756..d399606 100755
--- a/local/hooks/repo-specific/push-to-mirror
+++ b/local/hooks/repo-specific/push-to-mirror
@@ -1,24 +1,20 @@
-#!/bin/sh
-# Sourced from <https://github.com/miracle2k/gitolite-simple-mirror>
+#!/bin/execlineb
+# Ported to execline from <https://github.com/miracle2k/gitolite-simple-mirror>.
-# flush STDIN coming from git, because gitolite's own post-receive.mirrorpush
-# script does the same thing
-[ -t 0 ] || cat >/dev/null
+importas -u GL_REPO GL_REPO
-[ -z "$GL_REPO" ] && die GL_REPO not set
+backtick -i -n mirrors { git config gitolite.mirror.simple }
+importas -iu mirrors mirrors
-set -- $(git config --get gitolite.mirror.simple)
-[ "$#" -gt 0 ] || exit
+forx mirror { ${mirrors} }
+importas -u mirror mirror
-extra_args=$(git config --get gitolite.mirror.simple.extra-args)
+backtick -n GL_REPO_basename { basename "${GL_REPO}" }
+importas -u GL_REPO_basename GL_REPO_basename
-while [ "$#" -gt 0 ]; do
- # Support a REPO variable for wildcard mirrors
- gl_repo_escaped=$(printf '%s\n' "$GL_REPO" | sed 's/\//\\\//g')
- gl_repo_escaped=$(basename "${gl_repo_escaped}")
- target=$(printf '%s\n' "${1}" | sed "s/REPO/${gl_repo_escaped}/g")
-
- git push --mirror "${target}" ${extra_args} 2>&1 | sed 's/^/[mirror] /'
- shift
-done
+backtick -i mirror_escaped {
+ pipeline { printf "%s" "${mirror}" } sed "s/REPO/${GL_REPO_basename}/"
+}
+importas -u mirror_escaped mirror_escaped
+git push --prune --mirror ${mirror_escaped}