3 # Keep lastactivity and personal mob (if enabled) up-to-date
4 # We use receive.updateserverinfo=true so no need to run update-server-info
5 # Send notification through the taskd socket if it exists and not personal mob push
7 # Beware, we MAY be running in a chroot!
13 git config gitweb.lastchange
"$(date '+%a, %d %b %Y %T %z')" ||
:
14 git for-each-ref
--sort=-committerdate --format='%(committerdate:iso8601)' \
15 --count=1 refs
/heads
> info
/lastactivity ||
:
16 ! [ -d htmlcache
] ||
{ >htmlcache
/changed
; } 2>/dev
/null ||
:
17 rm -f .delaygc .allowgc
18 if [ "$mob" = "mob" -a -d mob
]; then
19 git for-each-ref
--format='%(objectname) %(refname)' > packed-refs.mob.$$ ||
:
20 mv -f packed-refs.mob.$$ packed-refs.mob
21 rm -f packed-refs.mob.$$
24 sockpath
=/etc
/taskd.socket
25 reporoot
=/@jailreporoot@
28 if [ -x @perlbin@
]; then
32 sockpath
="$cfg_chroot$sockpath"
33 reporoot
="$cfg_reporoot"
35 # authuser needs to be set if not running in the chroot.
36 # Currently that can only be the case with https push in
37 # which case REMOTE_USER will contain the user name (possibly prefixed
38 # with "/UID=" and suffixed with "/dnQualifier=...").
39 # Fallback is the mirror_user if REMOTE_USER is not set.
40 authuser
="${REMOTE_USER#/UID=}"
41 authuser
="${authuser%/dnQualifier=*}"
42 [ -n "$authuser" ] || authuser
="%$cfg_mirror_user%"
45 nc_openbsd
() { /bin
/nc.openbsd
"$@"; }
47 reporoot
="$(cd "$reporoot" && pwd -P)"
48 projname
="${cwd#$reporoot/}"
50 if [ -n "$GIROCCO_PERSONAL_MOB" ] ||
! [ -S "$sockpath" ]; then
51 # We never run the ref update notification part on a personal mob push
52 # Read the incoming refs, but just ignore them (git doesn't like SIGPIPE)
53 while read -r line
; do
59 echo "ref-changes $authuser ${projname%.git}" ||
:
60 while read -r line
; do
61 printf '%s\n' "$line" ||
:
63 ) 2>/dev
/null |
{ nc_openbsd
-w 15 -U "$sockpath" ||
:; }