3 # This script is called from the post-update hook, and when
4 # the master branch is updated, run in $HOME/git-doc, 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/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 $?
32 : ${PUBLIC=/pub/software/scm/git/docs} &&
33 : ${MASTERREPO=`pwd`} &&
34 : ${DOCREPO=`dirname "$0"`} &&
35 test "$DOCREPO" != "" &&
36 cd "$DOCREPO" ||
exit $?
41 trap 'rm -f "$tmp".*' 0
44 git pull
"$MASTERREPO" master
&&
45 git fetch
--tags "$MASTERREPO"
46 ) >/dev
/null
2>/dev
/null ||
exit $?
47 test $
(git rev-parse
--verify refs
/heads
/master
) == "$ID" &&
48 NID
=$
(git describe
--abbrev=4 "$ID") &&
49 test '' != "$NID" ||
exit $?
51 # Set up subrepositories
54 test -d doc-
${type}pages ||
(
55 mkdir doc-
${type}pages
&&
56 cd doc-
${type}pages
&&
57 git init-db ||
exit $?
59 git fetch-pack
"$MASTERREPO" ${type} |
64 git update-ref HEAD
$sha1 &&
65 git checkout ||
exit $?
74 case "$(asciidoc --version 2>&1)" in
80 make >.
/:html.log
2>&1 \
81 -C Documentation
-j 2 \
82 WEBDOC_DEST
="$DOCREPO/doc-html-inst" install-webdoc ||
exit
84 make >.
/:man.log
2>&1 \
85 -C Documentation
-j 2 \
86 man1
="$DOCREPO/doc-man-inst/man1" \
87 man5
="$DOCREPO/doc-man-inst/man5" \
88 man7
="$DOCREPO/doc-man-inst/man7" \
89 man1dir
="$DOCREPO/doc-man-inst/man1" \
90 man5dir
="$DOCREPO/doc-man-inst/man5" \
91 man7dir
="$DOCREPO/doc-man-inst/man7" install ||
exit
95 find doc-
$type-inst -type f |
98 it
=$
(expr "$path" : doc-
$type-inst/'\(.*\)') ||
continue
99 t
="doc-${type}pages/$it"
100 test -f "$t" && diff -q "$path" "$t" && continue
101 mkdir
-p "$(dirname "$t")" &&
102 echo ": $t" && rm -f "$t" && ln "$path" "$t" ||
exit
103 ( cd doc-
${type}pages
&& git add
"$it" )
106 find doc-
$type-inst -type f |
107 sed -e 's|^doc-'$type'-inst/||' |
sort >"$tmp.1" &&
108 (cd doc-
${type}pages
&& git ls-files |
sort) >"$tmp.2" &&
109 comm -13 "$tmp.1" "$tmp.2" |
110 ( cd doc-
${type}pages
&& xargs rm -f -- ) ||
exit
119 ln -sf git.html index.html
127 if git commit
-a -m "Autogenerated $TYPE for $NID"
129 git send-pack
"$MASTERREPO" master
:refs
/heads
/$type \
132 echo "* No changes in $type docs"
140 mv Documentation
/git.html Documentation
/saved-git-html
141 make >>.
/:html.log
2>&1 \
143 WEBDOC_DEST
="$PUBLIC" ASCIIDOC_EXTRA
='-a stalenotes' \
145 mv Documentation
/saved-git-html Documentation
/git.html
147 echo "* No public html at $PUBLIC"