Rewrite documentation hook
Junio C Hamano committed
Dec 27, 2005 at 00:04 UTC
7dc35b9485d248b109fa31d6c0edcbda4971b770
2 files changed
+104
-32
R
deleted
-32
@@ -1,32 +0,0 @@
1
-#!/bin/sh
2
-
3
-m=$(git-rev-parse "master^0")
4
-for branch
5
-do
6
- b=$(git-rev-parse "$branch^0")
7
- case "$(git-merge-base --all "$b" "$m")" in
8
- "$m")
9
- echo >&2 "$branch: up to date"
10
- continue
11
- ;;
12
- esac
13
- git-show-branch "$branch" master
14
- while :
15
- do
16
- echo -n >&2 "Rebase $branch [Y/n]? "
17
- read ans
18
- case "$ans" in
19
- [Yy]*)
20
- git rebase master "$branch" || exit
21
- break
22
- ;;
23
- [Nn]*)
24
- echo >&2 "Not rebasing $branch"
25
- break
26
- ;;
27
- *)
28
- echo >&2 "Sorry, I could not hear you"
29
- ;;
30
- esac
31
- done
32
-done
dodoc.sh
new
+104
@@ -0,0 +1,104 @@
1
+#!/bin/sh
2
+#
3
+# This script is called from the post-update hook, and when
4
+# the master branch is updated, run in $HOME/doc-git, like
5
+# this:
6
+: <<\END_OF_COMMENTARY
7
+
8
+$ cat >hooks/post-update
9
+#!/bin/sh
10
+case " $* " in
11
+*' refs/heads/master '*)
12
+ echo $HOME/git-doc/dodoc.sh | at now
13
+ ;;
14
+esac
15
+exec git-update-server-info
16
+$ chmod +x hooks/post-update
17
+
18
+END_OF_COMMENTARY
19
+
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.
27
+
28
+ID=`git-rev-parse --verify refs/heads/master` || exit $?
29
+
30
+unset GIT_DIR
31
+
32
+PUBLIC=/pub/software/scm/git/docs &&
33
+MASTERREPO=`pwd` &&
34
+DOCREPO=`dirname "$0"` &&
35
+test "$DOCREPO" != "" &&
36
+cd "$DOCREPO" || exit $?
37
+
38
+git pull "$MASTERREPO" master &&
39
+test $(git-rev-parse --verify refs/heads/master) == "$ID" || exit $?
40
+
41
+# Set up subrepositories
42
+test -d doc-htmlpages || (
43
+ mkdir doc-htmlpages &&
44
+ cd doc-htmlpages &&
45
+ git init-db || exit $?
46
+
47
+ if ID=$(git fetch-pack "$MASTERREPO" html)
48
+ then
49
+ git update-ref HEAD `expr "$ID" : '\(.*\) .*'` &&
50
+ git checkout || exit $?
51
+ fi
52
+)
53
+test -d doc-manpages || (
54
+ mkdir doc-manpages &&
55
+ cd doc-manpages &&
56
+ git init-db || exit $?
57
+
58
+ if ID=$(git fetch-pack "$MASTERREPO" man)
59
+ then
60
+ git update-ref HEAD `expr "$ID" : '\(.*\) .*'` &&
61
+ git checkout || exit $?
62
+ fi
63
+)
64
+find doc-htmlpages doc-manpages -type d -name '.git' -prune -o \
65
+ -type f -print0 | xargs -0 rm -f
66
+
67
+cd Documentation &&
68
+make WEBDOC_DEST="$DOCREPO/doc-htmlpages" install-webdoc >../:html.log 2>&1 &&
69
+
70
+if test -d $PUBLIC
71
+then
72
+ make WEBDOC_DEST="$PUBLIC" install-webdoc >>../:html.log 2>&1
73
+else
74
+ echo "* No public html at $PUBLIC"
75
+fi || exit $?
76
+
77
+cd ../doc-htmlpages &&
78
+ git add . &&
79
+ if git commit -a -m "Autogenerated HTML docs for $ID"
80
+ then
81
+ git-send-pack "$MASTERREPO" master:refs/heads/html || {
82
+ echo "* HTML failure"
83
+ exit 1
84
+ }
85
+ else
86
+ echo "* No changes in html docs"
87
+ fi
88
+
89
+cd ../Documentation &&
90
+make man1="$DOCREPO/doc-manpages/man1" man7="$DOCREPO/doc-manpages/man7" \
91
+ install >../:man.log 2>&1 &&
92
+
93
+cd ../doc-manpages &&
94
+ git add . &&
95
+ if git commit -a -m "Autogenerated man pages for $ID"
96
+ then
97
+ git-send-pack "$MASTERREPO" master:refs/heads/man || {
98
+ echo "* man failure"
99
+ exit 1
100
+ }
101
+ else
102
+ echo "* No changes in manual pages"
103
+ fi
104
+