2 # generic git post-receive hook.
3 # change the config options below and call this script in your post-receive
8 # if name is not set the basename of the current directory is used,
9 # this is the directory of the repo when called from the post-receive script.
12 if test "${name}" = ""; then
13 name=$(basename $(pwd))
17 # paths must be absolute.
18 reposdir="/home/src/src"
19 dir="${reposdir}/${name}"
20 htmldir="/home/www/domains/git.codemadness.org/htdocs"
22 destdir="${htmldir}${stagitdir}"
23 cachefile=".htmlcache"
26 if ! test -d "${dir}"; then
27 echo "${dir} does not exist" >&2
34 while read -r old new ref; do
35 hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q)
36 if test -n "${hasrevs}"; then
43 r=$(basename "${name}")
44 d=$(basename "${name}" ".git")
45 printf "[%s] stagit HTML pages... " "${d}"
47 mkdir -p "${destdir}/${d}"
48 cd "${destdir}/${d}" || exit 1
50 # remove commits and ${cachefile} on git push -f, this recreated later on.
51 if test "${force}" = "1"; then
57 stagit-index "${reposdir}/"*/ > "${destdir}/index.html"
60 stagit -c "${cachefile}" "${reposdir}/${r}"
62 ln -sf log.html index.html
63 ln -sf ../style.css style.css
64 ln -sf ../logo.png logo.png