mirroring/update.sh: Remove the obsolete --git-dir=.
[girocco/test-forks.git] / mirroring / clone.sh
blob8a45bcc887220ab0b9e7fd760d7426c6b4e8b1e9
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 set -e
7 projdir="$1"
8 proj="${projdir%.git}"
10 bang_setup
11 bang_action="clone"
12 bang_trap() {
13 # This removes our stage directory _and_ gets rid of the group record.
14 perl -I@basedir@ -MGirocco::Project -e 'Girocco::Project->load('"'$proj'"')->delete;'
17 cd "$cfg_reporoot/$projdir"
18 url="$(cat base_url)"
19 mail="$(cat owner)"
21 # First, the boring clone itself
22 ref=()
23 if [ -s objects/info/alternates ]; then
24 ref=(--reference "$(cat objects/info/alternates | sed 's#/objects$##')")
25 bang rm objects/info/alternates
26 bang rmdir -p objects/info
28 bang git clone "${ref[@]}" --bare "$url" repodir
30 # Reconcile repodir and .
31 bang mv repodir/* .
32 bang rmdir repodir
34 # Reconfigure
35 bang git config --bool --add mirror.allowed true
36 bang git update-server-info
38 mail -s "[$cfg_name] $proj clone completed" "$mail,$cfg_admin" <<EOT
39 Congratulations! The clone of project $proj just completed.
41 * GitWeb interface: $cfg_gitweburl/$projdir
42 * Project settings: $cfg_webadmurl/editproj.cgi?name=$proj
44 Have a lot of fun.
45 EOT