3 # This script is called from the post-update hook, and when
4 # the master branch is updated, run in $HOME/doc-git, like
8 $ cat >hooks/post-update
11 *' refs/heads/master '*)
12 echo $HOME/git-doc/dodoc.sh | at now
15 exec git-update-server-info
16 $ chmod +x hooks/post-update
20 # $HOME/doc-git is a clone of the git.git repository and
21 # has the master branch checkd out. We update the working
22 # tree and build pre-formatted documentation pages, install
23 # in doc-htmlpages and doc-manapges subdirectory here.
24 # These two are their own git repository, and when they are
25 # updated the updates are pushed back into their own branches
26 # in git.git repository.
28 ID=`git-rev-parse --verify refs/heads/master` || exit $?
32 PUBLIC=/pub/software/scm/git/docs &&
34 DOCREPO=`dirname "$0"` &&
35 test "$DOCREPO" != "" &&
36 cd "$DOCREPO" || exit $?
38 git pull "$MASTERREPO" master &&
39 test $(git-rev-parse --verify refs/heads/master) == "$ID" || exit $?
41 # Set up subrepositories
42 test -d doc-htmlpages || (
43 mkdir doc-htmlpages &&
45 git init-db || exit $?
47 if ID=$(git fetch-pack "$MASTERREPO" html)
49 git update-ref HEAD `expr "$ID" : '\(.*\) .*'` &&
50 git checkout || exit $?
53 test -d doc-manpages || (
56 git init-db || exit $?
58 if ID=$(git fetch-pack "$MASTERREPO" man)
60 git update-ref HEAD `expr "$ID" : '\(.*\) .*'` &&
61 git checkout || exit $?
64 find doc-htmlpages doc-manpages -type d -name '.git' -prune -o \
65 -type f -print0 | xargs -0 rm -f
68 make WEBDOC_DEST="$DOCREPO/doc-htmlpages" install-webdoc >../:html.log 2>&1 &&
72 make WEBDOC_DEST="$PUBLIC" install-webdoc >>../:html.log 2>&1
74 echo "* No public html at $PUBLIC"
77 cd ../doc-htmlpages &&
79 if git commit -a -m "Autogenerated HTML docs for $ID"
81 git-send-pack "$MASTERREPO" master:refs/heads/html || {
86 echo "* No changes in html docs"
89 cd ../Documentation &&
90 make man1="$DOCREPO/doc-manpages/man1" man7="$DOCREPO/doc-manpages/man7" \
91 install >../:man.log 2>&1 &&
95 if git commit -a -m "Autogenerated man pages for $ID"
97 git-send-pack "$MASTERREPO" master:refs/heads/man || {
102 echo "* No changes in manual pages"