summaryrefslogtreecommitdiff
path: root/hooks/post-receive
blob: 7f66079867f9e6775e3dcd28668510c88a29320c (plain)
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
#!/bin/sh
if ! [ "$DID_SELF_UPDATE" ]
then
    GIT_WORK_TREE=. git checkout -f master -- hooks/post-receive
    DID_SELF_UPDATE=y exec hooks/post-receive
fi

WARNINGS=y

warn()
{
    if [ "$WARNINGS" ]
    then
        printf '%s: Warning: %s\n' "$0" "$*" >&2
    fi
}

die()
{
    printf '%s: Error: %s\n' "$0" "$*" >&2
    exit 1
}

GIT_WORK_TREE=. git checkout -f master -- authorized_keys.d/\*

export GIT_WORK_TREE=${GIT_DIR%.git}

git checkout -f master || die 'command failed: git checkout'
cd "$GIT_WORK_TREE" || die 'command failed: cd $GIT_WORK_TREE'
make