Meta/V checks the versions of four primary integration branches.
[git/spearce.git] / dodoc.sh
blob7869dac5be4ebf8d782856afe0283506c3d77141
1 #!/bin/sh
3 # This script is called from the post-update hook, and when
4 # the master branch is updated, run in $HOME/git-doc, like
5 # this:
6 : <<\END_OF_COMMENTARY
8 $ cat >hooks/post-update
9 #!/bin/sh
10 case " $* " in
11 *' refs/heads/master '*)
12 echo $HOME/git-doc/dodoc.sh | at now
14 esac
15 exec git-update-server-info
16 $ chmod +x hooks/post-update
18 END_OF_COMMENTARY
20 # $HOME/git-doc 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 $?
30 unset GIT_DIR
32 PUBLIC=/pub/software/scm/git/docs &&
33 MASTERREPO=`pwd` &&
34 DOCREPO=`dirname "$0"` &&
35 test "$DOCREPO" != "" &&
36 cd "$DOCREPO" || exit $?
38 git pull "$MASTERREPO" master &&
39 git fetch --tags "$MASTERREPO" || exit $?
40 test $(git-rev-parse --verify refs/heads/master) == "$ID" &&
41 NID=$(git-describe --abbrev=4 "$ID") &&
42 test '' != "$NID" || exit $?
44 # Set up subrepositories
45 test -d doc-htmlpages || (
46 mkdir doc-htmlpages &&
47 cd doc-htmlpages &&
48 git init-db || exit $?
50 if SID=$(git fetch-pack "$MASTERREPO" html)
51 then
52 git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
53 git checkout || exit $?
56 test -d doc-manpages || (
57 mkdir doc-manpages &&
58 cd doc-manpages &&
59 git init-db || exit $?
61 if SID=$(git fetch-pack "$MASTERREPO" man)
62 then
63 git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
64 git checkout || exit $?
67 find doc-htmlpages doc-manpages -type d -name '.git' -prune -o \
68 -type f -print0 | xargs -0 rm -f
70 cd Documentation &&
71 make WEBDOC_DEST="$DOCREPO/doc-htmlpages" install-webdoc >../:html.log 2>&1 &&
73 if test -d $PUBLIC
74 then
75 # This is iffy...
76 mv git.html saved-git-html &&
77 make WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
78 install-webdoc >>../:html.log 2>&1 &&
79 mv saved-git-html git.html
80 else
81 echo "* No public html at $PUBLIC"
82 fi || exit $?
84 cd ../doc-htmlpages &&
85 (git add . || echo no new files -- not a big deal) &&
86 if git commit -a -m "Autogenerated HTML docs for $NID"
87 then
88 git-send-pack "$MASTERREPO" master:refs/heads/html || {
89 echo "* HTML failure"
90 exit 1
92 else
93 echo "* No changes in html docs"
96 cd ../Documentation &&
97 make \
98 man1="$DOCREPO/doc-manpages/man1" \
99 man7="$DOCREPO/doc-manpages/man7" \
100 man1dir="$DOCREPO/doc-manpages/man1" \
101 man7dir="$DOCREPO/doc-manpages/man7" \
102 install >../:man.log 2>&1 &&
104 cd ../doc-manpages &&
105 (git add . || echo no new files -- not a big deal) &&
106 if git commit -a -m "Autogenerated man pages for $NID"
107 then
108 git-send-pack "$MASTERREPO" master:refs/heads/man || {
109 echo "* man failure"
110 exit 1
112 else
113 echo "* No changes in manual pages"