8 cd "$cfg_reporoot/$proj.git"
10 if check_interval lastrefresh
$cfg_min_mirror_interval; then
11 progress
"= [$proj] update skip (last at $(config_get lastrefresh))"
14 progress
"+ [$proj] update (`date`)"
20 url
="$(config_get baseurl)"
21 mail="$(config_get owner)"
23 bang git for-each-ref
--format '%(refname) %(objectname)' >.refs-before
27 GIT_DIR
=. bang git svn fetch
28 GIT_DIR
=. bang git fetch
31 [ "$url" = "$(config_get remote.origin.url)" ] || bang config_set remote.origin.url
"$url"
32 bang git remote update
33 bang git remote prune origin
37 bang git update-server-info
38 bang config_set lastrefresh
"$(date -R)"
40 # Look at which refs changed and trigger ref-change for these
41 bang git for-each-ref
--format '%(refname) %(objectname)' >.refs-after
42 sockpath
="$cfg_chroot/etc/taskd.socket"
43 if [ -S "$sockpath" ] && ! cmp -s .refs-before .refs-after
; then
45 join -j 1 .refs-before .refs-after |
46 while read ref old new
; do
47 [ "$old" != "$new" ] ||
continue
48 echo "ref-change -1 $proj $old $new $ref"
50 join -j 1 -v 1 .refs-before .refs-after |
51 while read ref old
; do
52 echo "ref-change -1 $proj $old 0000000000000000000000000000000000000000 $ref"
54 join -j 1 -v 2 .refs-before .refs-after |
55 while read ref new
; do
56 echo "ref-change -1 $proj 0000000000000000000000000000000000000000 $new $ref"
58 } | nc.openbsd
-w 1 -U "$sockpath"
61 rm -f .refs-before .refs-after
63 if [ -e .banged
]; then
64 echo "$proj update succeeded - failure recovery" |
mail -s "[$cfg_name] $proj update succeeded" "$mail,$cfg_admin"
68 progress
"- [$proj] update (`date`)"