This file is indexed.

/usr/share/gitolite/gl-mirror-push is in gitolite 2.3-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh

# arguments: reponame, list of slaves

# optional flag after reponame: "-fg" to run in foreground.  This is only
# going to be given by one specific invocation, and if given will only work
# for one slave.

# if list of slaves not given, get it from '...slaves' config

die() { echo gl-mirror-push${hn:+ on $hn}: "$@" >&2; exit 1; }
get_rc_val() { `dirname $0`/gl-query-rc $1; }

# ----------

# is mirroring even enabled?
hn=`get_rc_val GL_HOSTNAME`
[ -z "$hn" ] && exit

# we should not be invoked directly from the command line
[ -z "$GL_LOG" ] && die fatal: do not run $0 directly

# ----------

# get repo name then check if it's a local or slave (ie we're not the master)
[ -z "$1" ] && die fatal: missing reponame argument
repo=$1; shift

REPO_BASE=`get_rc_val REPO_BASE`
cd $REPO_BASE/$repo.git 2>/dev/null || die fatal: could not change directory to "$repo"
gmm=`git config --get gitolite.mirror.master`

# is it local? (remember, empty/undef ==> local
gmm=${gmm:-local}
[ "$gmm" = "local" ] && die sorry but "$repo" is local

# is it a slave?
[ "$hn" = "$gmm" ] || die fatal: wrong master.  Try $gmm...

# ----------

# now see if we want to be foregrounded.  Fg mode accepts only one slave
[ "$1" = "-fg" ] && {
    [ -z "$2" ] && die fatal: missing slavename argument
    [ -n "$3" ] && die fatal: too many slavenames
    git push --mirror $2:$repo 2>&1 | sed -e "s/^/$hn:/"
    exit
}

# ----------

# normal (self-backgrounding) mode, one or more slaves

[ -z "$1" ] && die fatal: missing list of slaves
export slaves
slaves="$*"

# ----------

# print out the job ID, then redirect all 3 FDs
export job_id=$$        # can change to something else if needed
echo "($job_id&) $hn ==== ($repo) ===>" $slaves >&2
logfile=`echo $GL_LOG | sed 's/\.log$/-mirror-pushes.log/'`
exec >>$logfile 2>&1 </dev/null

# ----------

# and finally...

# double fork, no zombies
(
    (
        echo `date +%F.%T` $repo '===>'

        for s in $slaves
        do
            [ "$s" = "$hn" ] && continue    # skip ourselves
            git push --mirror $s:$repo || echo ==== WARNING: RC=$? from git push --mirror $s:$repo ====
        done 2>&1 | sed -e "s/^/    /"
        echo `date +%F.%T` '===>' $slaves
        echo
    )  2>&1 | sed -e "s/^/$job_id:/" &        # background the whole thing
)