aboutsummaryrefslogtreecommitdiff
path: root/local/hooks/repo-specific/push-to-mirror
blob: d399606bcfbe7ba818bcbdbc3b6a88d4f97a54a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/execlineb
# Ported to execline from <https://github.com/miracle2k/gitolite-simple-mirror>.

importas -u GL_REPO GL_REPO

backtick -i -n mirrors { git config gitolite.mirror.simple }
importas -iu mirrors mirrors

forx mirror { ${mirrors} }
importas -u mirror mirror

backtick -n GL_REPO_basename { basename "${GL_REPO}" }
importas -u GL_REPO_basename GL_REPO_basename

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}